apollographql / apollo-tooling

✏️ Apollo CLI for client tooling (Mostly replaced by Rover)
https://apollographql.com
MIT License
3.04k stars 470 forks source link

Better error messaging around incorrect API key #1166

Open trevor-scheer opened 5 years ago

trevor-scheer commented 5 years ago

During (at least) client:push, if the API key is incorrect, the CLI responds with a vague 406 error that doesn't help the user. Make the error more helpful 😄

freshcoat commented 5 years ago

Have this same issue, did you manage to fix it?

Log output VSC:

------------------------------
🚀 Apollo GraphQL v1.7.1
------------------------------
✅ Service Loaded!
🆔 Service ID: name-1234
🏷 Schema Tag: current
📈 Number of Types: 0 (0 client types)
------------------------------
[GraphQL error]: Response not successful: Received status code 406
[GraphQL error]: Response not successful: Received status code 406
[Network Error] undefined
[Network Error]: ServerError: Response not successful: Received status code 406
[Network Error] undefined
seanscal commented 4 years ago

@trevor-scheer help

philip-nicholls commented 2 years ago

A 401 would be much more appropriate here. Using 406 is a severe misuse of HTTP standards. A 406 response relates to a server not being able to send the correct representation based on the incoming Accepts header, so absolutely nothing to do with auth.

smyrick commented 2 years ago

FYI, the apollo-cli is deprecated for any subgraph/supergraph commands and Rover is the new supported CLI: https://www.apollographql.com/docs/rover/migration

If you are getting HTTP 406 errors please consider migrating to using Rover which has more features, better error messaging, and LTS support.

Rover does not support the client:push command at this time, as the client operation registry has also been deprecated, so you will have to continue using apollo-cli

MincePie commented 2 years ago

Is there a tuturoial showing what to do here? I have the rover CLI, but I cannot find a way to finish the setup on the apollo graph (federation 2 classic graph). The instructions on the apollo site are not clear. I am getting an error in my logs that says: Error sending report to Apollo servers: HTTP status 406, Please check your API key in the Engine configuration. I'm sure I dont have this configured properly. I have tried to publish my rover subgraph in the terminal (using the line copied and pasted from the setup instructions), however, I get an error in the terminal in response to that which says: Invalid path. No file found at ./products-schema.graphql. I have not made a file with this name - but do not know where to make it or what to put in it.

MincePie commented 2 years ago

In the step of the apollo instructions that say: If a "Publish your Schema" dialog appears, copy the protected value that appears after APOLLO_KEY= in the example code block (it begins with service:), and you're all set.

So does that mean that I just copy the masked component of the key (ie not the words that are visible on the screen whilst the eye icon is struck out? (so the word service and rest of the visible text would not be considered part of the apollo graph key?

MincePie commented 2 years ago

In this instruction, I don't know what 'substituting the path to the tarball requires. "After downloading, extract the file by running the following from a new project directory, substituting the path to the tarball:"

What am I supposed to substitute? What piece of information am I supposed to use as the substitition? Is this router different to the react router?

MincePie commented 2 years ago

In the quick start instructions, there are three greyed out instructions as follows:

rover subgraph publish mygraphname-randomstring@current \ --schema ./products-schema.graphql \ --name your-subgraph-name \ --routing-url http://products.prod.svc.cluster.local:4001/graphql

What am I supposed to do with these?

MincePie commented 2 years ago

When I do rover config whoami, I get the end of an apollo key that does not match the one I copied from the setup instructions for the graph - it is pasted in my .env file. I dont know how else rover would have an auth key from me

MincePie commented 2 years ago

When I try to follow the config instructions on this page: https://www.apollographql.com/docs/rover/migration/#checking-a-graphs-changes-with-a-config-file, I get an error that says:

rover graph introspect http://localhost:4000 error[E028]: error sending request for url (http://localhost:4000/): error trying to connect: tcp connect error: Connection refused (os error 61) Make sure the endpoint is accepting connections and is spelled correctly

MincePie commented 2 years ago

When I follow the setup instructions on the above linked page, I am asked to make random locations and reviews pages in my root directory. I do that, but when I try to publish my schema, I still get an error because it expects a file:Use a local file containing the subgraph schema (e.g., called products-schema.graphql)

I can't find instructions for how to make that or what to put in it.

MincePie commented 2 years ago

If I rename the reviews.graphql file to become products-schema.graphql, i can publish the schema in rover, but then instead of linking to my prisma schema, it goes to this random file. How do i configure apollo to read my prisma schema?

trevor-scheer commented 2 years ago

@MincePie this repo is largely unmaintained, and this issue is ~3 years old. Please keep discussion here relevant to the issue subject.

If you're trying to use Rover, you'll get much better help in the community or in the rover repo. https://community.apollographql.com/ https://github.com/apollographql/rover