question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: improve error message when the request fails

See original GitHub issue

Hello, graphman worked with my local backend, nice ❤️

I tried to do that

# create a new token
$ open https://github.com/settings/tokens/new
$ export GITHUB_TOKEN="xxxxxxxx"
# works for me
$ curl -H "Authorization: bearer $GITHUB_TOKEN" https://api.github.com/graphql
$ alias graphman="deno  run  https://deno.land/x/graphman@v1.0.3/src/index.ts"
$ graphman https://api.github.com/graphql --auth="bearer $GTHUB_TOKEN"
Creating the postman collection for https://api.github.com/graphql
⚠️  ️Deno requests net access to "api.github.com". Run again with --allow-net to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '__schema')
  const queryTypeName = introspectionQuery.__schema.queryType
                                           ^
    at createPostmanCollection (https://deno.land/x/graphman@v1.0.3/src/lib.ts:308:44)
    at async https://deno.land/x/graphman@v1.0.3/src/index.ts:38:20

Reference: https://docs.github.com/en/graphql/guides/forming-calls-with-graphql#communicating-with-graphql

EDIT:

The actual issue is the lack of a good error message when the http call fails

As it turns out it was a typo (thanks for the comments)

$ graphman https://api.github.com/graphql --auth="bearer $GITHUB_TOKEN"
Collection saved at ./out/api.github.com-GraphMan.postman_collection.json
Import it in postman and complete the queries ! 🚀

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jmfayardcommented, Aug 11, 2022

@c3b5aw @nohehf it was indeed a typo and the issue is the cryptic error message, I updated the ticket.

Another question: could you clarify in the README how to bypass those warnings?

It was unclear to me where to put the arguments, I’m not familiar with deno.

⚠️  ️Deno requests net access to "api.github.com". Run again with --allow-net to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
⚠️  ️Deno requests read access to "./out/". Run again with --allow-read to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
⚠️  ️Deno requests write access to "./out/api.github.com-GraphMan.postman_collection.json". Run again with --allow-write to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
Collection saved at ./out/api.github.com-GraphMan.postman_collection.json
1reaction
c3b5awcommented, Aug 10, 2022
https://api.github.com/graphql --auth="bearer $GTHUB_TOKEN"

Hello @jmfayard,

On my end everything is working properly, can you take away my doubt and re-try with a correct environment variable ? I suspect a typo error as $GTHUB_TOKEN is missing a I.

@nohehf, maybe it miss a bit of feedback whenever the request failed to get a correct introspection. - Here it would deny the request for invalid auth. I suggest that you print the response received on 401, 500 etc, as well as when the payload is a valid graphql payload and contains an error key.

Read more comments on GitHub >

github_iconTop Results From Across the Web

feat: improve the error message of expand #11141 - vitejs/vite
Read the Pull Request Guidelines and follow the Commit Convention. Check that there isn't already a PR that solves the problem the same...
Read more >
Improved failure detection for functional errors based on ...
Dynatrace failure detection automatically detects the vast majority of error conditions in your environment, including the underlying root ...
Read more >
husky - Strange error when attempting to commit. [subject-empty]
To fix the error, change your commit message ("Hello world") to follow the Conventional Commits format, e.g. to "feat: hello world".
Read more >
Error Screens and Messages: UX Design Practices - Tubik Blog
The article shares insights on the UX design of error screens and writing error messages: learn how to smoothen the negative effect of...
Read more >
How to catch error message when a request fails? - Help
my test sends a request and validate code status to be one of 200 or 204. And there will be an error message...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found