load_introspection_from_server does not use custom headers
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- graphql, python
- Domain
- api, authentication
Research direction
Start with load_introspection_from_server in utils_schema.py and trace how schema loading receives the configured custom_header values. Check the authenticated introspection request path and any related tests or command configuration. Done means the configured headers are used when loading the schema and the reported 401 case is covered.
Written by the indexing model from the issue text.
Description
Hello I'm trying to test gql but running gql run returned
[...]
File "/home/rdebroiz/.virtualenvs/test_gql/lib/python3.7/site-packages/gql/utils_schema.py", line 22, in load_schema
introspection = load_introspection_from_file(uri) if os.path.isfile(uri) else load_introspection_from_server(uri)
File "/home/rdebroiz/.virtualenvs/test_gql/lib/python3.7/site-packages/gql/utils_schema.py", line 13, in load_introspection_from_server
raise Exception(f'Query failed to run by returning code of {request.status_code}. {query}')
Exception: Query failed to run by returning code of 401.
[...]
I suspect the cause is that the custom headers are not used to load the schema from the configured endpoint.
def load_introspection_from_server(url):
query = get_introspection_query()
request = requests.post(url, json={'query': query})
if request.status_code == 200:
return request.json()['data']
raise Exception(f'Query failed to run by returning code of {request.status_code}. {query}')
Here is what my .gql.json look likes:
{
"schema": "http://hasura:10004/v1alpha1/graphql",
"endpoint": "http://hasura:10004/v1alpha1/graphql",
"documents": "./**/*.graphql",
"custom_header": {
"x-hasura-admin-secret": "adminpw",
"x-hasura-access-key": "userpw"
}
}
- Dominant language
- Python
- Stars
- 78
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from graphql-python/gql-next
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
graphql-python/gql-next#30 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
graphql-python/gql-next#29 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
graphql-python/gql-next#28 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
graphql-python/gql-next#27 ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
graphql-python/gql-next#22 · 1 comment ·
All issues in graphql-python/gql-next
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/skills#1811 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
speaches-ai/speaches#678 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
datalayer/mcp-compose#42 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
UKGovernmentBEIS/inspect_evals#2523 ·