apollographql / apollographql/apollo-tooling
Cover auth failure case before `It looks like there are 0 files associated with this Apollo Project.`
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
We have a graphql endpoint that requires authorization, when we properly pass `--header "Authorization: Bearer ..."` to `apollo client:download-schema`, things work nicely. When we don't, we get:
> ⚠️ It looks like there are 0 files associated with this Apollo Project. This may be because you don't have any files yet, or your includes/excludes fields are configured incorrectly, and Apollo can't find your files. For help configuring Apollo projects, see this guide: https://go.apollo.dev/t/config
https://github.com/apollographql/apollo-tooling/blob/a778ca162bdd20be9e60a914887302390c274644/packages/apollo-language-server/src/project/client.ts#L138-L141
This is fairly misleading/confusing and has resulted in myself and others wasting a lot of time trying to figure out if something else was wrong.
If apollo encounters a 4xx series error (especially 400/401), it'd be really helpful if it reported the url and error instead of just providing the current output.
Contributor guide
Research direction
Start with packages/apollo-language-server/src/project/client.ts around lines 138-141 and reproduce apollo client:download-schema against an authorization-required GraphQL endpoint, both with and without the Authorization header. Confirm that the unauthenticated 4xx response is surfaced with its URL and error instead of the misleading zero-files message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100