apollographql / apollographql/apollo-tooling
ServerParseError: Unexpected token G in JSON at position 0
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
**Intended outcome:**
I'm trying to upload our schema to Apollo Graph Manager:
`apollo service:push --endpoint http://api.mysite.net`
**Actual outcome:**
```
✔ Loading Apollo Project
✖ Uploading service to Engine
→ Unexpected token G in JSON at position 0
ServerParseError: Unexpected token G in JSON at position 0
at JSON.parse ()
at /usr/local/lib/node_modules/apollo/node_modules/apollo-link-http-common/lib/index.js:35:25
```
But if I use https instead of http it is working fine.
Example:
```
apollo service:push --endpoint https://api.mysite.net
✔ Loading Apollo Project
✔ Uploading service to Engine
No change in schema from previous version
╔════════╤═════════╤═════════╗
║ id │ graph │ tag ║
╟────────┼─────────┼─────────╢
║ dc132f │ FASTCUP │ current ║
╚════════╧═════════╧═════════╝
```
**Versions**
apollo/2.19.0 darwin-x64 node-v12.11.0
Contributor guide
Research direction
Start with the reported stack trace in apollo-link-http-common/lib/index.js and reproduce the upload using the HTTP and HTTPS endpoint forms shown. Compare the responses handled by the CLI; done means the HTTP command no longer fails with a JSON parse error or otherwise reports the response clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100