Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"error": "Unexpected token P in JSON at position 0" #1162

Closed
jlarmstrongiv opened this issue Dec 17, 2019 · 9 comments
Closed

"error": "Unexpected token P in JSON at position 0" #1162

jlarmstrongiv opened this issue Dec 17, 2019 · 9 comments

Comments

@jlarmstrongiv
Copy link

Created a new issue (as requested by @janpio ) with a reproducible example.

I have been debugging this all night. The issue cannot be reproduced on mac. However, it causes errors on windows and unix (vscode online).

Here's a sample repo:
https://github.com/jlarmstrongiv/temp-prisma-template

Steps:

  • cd temp-prisma-template
  • yarn install
  • npx prisma2 dev
  • yarn generate
  • yarn dev:nexus
@jlarmstrongiv
Copy link
Author

See #985

@jlarmstrongiv
Copy link
Author

Downgrading to 17.2 did not fix the issue for me

@janpio
Copy link
Member

janpio commented Dec 17, 2019

What errors are you getting? Please share the full error message.

@janpio
Copy link
Member

janpio commented Dec 17, 2019

Tried your reproduction:

Here's a sample repo:
https://github.com/jlarmstrongiv/temp-prisma-template

Steps:

  • cd temp-prisma-template
  • yarn install
  • npx prisma2 dev
  • yarn generate
  • yarn dev:nexus

This worked perfectly fine for me:

C:\Users\Jan\Documents
λ cd throwaway\

C:\Users\Jan\Documents\throwaway
λ git clone https://github.com/jlarmstrongiv/temp-prisma-template 1162
Cloning into '1162'...
remote: Enumerating objects: 50, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 50 (delta 13), reused 49 (delta 12), pack-reused 0
Unpacking objects: 100% (50/50), done.

C:\Users\Jan\Documents\throwaway\1162 (master -> origin)
λ yarn install
yarn install v1.17.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.1.2: The platform "win32" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "graphql-yoga > graphql-playground-middleware-lambda@1.7.12" has unmet peer dependency "aws-lambda@^0.1.2".
warning "graphql-yoga > graphql-subscriptions@0.5.8" has incorrect peer dependency "graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core@1.4.0" has incorrect peer dependency "graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core > apollo-cache-control@0.1.1" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
warning "graphql-yoga > apollo-server-express > apollo-server-core > apollo-tracing@0.1.4" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
warning "graphql-yoga > apollo-server-express > apollo-server-core > graphql-extensions@0.0.10" has incorrect peer dependency "graphql@0.10.x - 0.13.x".
[4/4] Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.21.1", while you're on "1.17.3".
Done in 45.43s.

C:\Users\Jan\Documents\throwaway\1162 (master -> origin)
λ C:\Users\Jan\Documents\throwaway\1162
C:\Users\Jan\Documents\throwaway\1162 (master -> origin)
λ npx prisma2 -v
prisma2@2.0.0-preview018.2, binary version: 3c4da1d6caa0c40a0210a346ec982c77f74e18c7

C:\Users\Jan\Documents\throwaway\1162 (master -> origin)
λ npx prisma2 dev

   Watching for changes in prisma\schema.prisma
   Last changed at 21:50:10


   Migrations
   ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  ✓ Database successfully migrated in 321ms
   To save changes into a migration file, run prisma2 lift save


   Generators
   ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  ✓ Photon.js    Generated in 9.57s





















































   Studio endpoint: http://localhost:5555/
   ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   d: diff
Terminate batch job (Y/N)?
^C
C:\Users\Jan\Documents\throwaway\1162 (master -> origin)
λ yarn generate
yarn run v1.17.3
$ yarn -s generate:prisma && yarn -s generate:types && yarn -s generate:nexus
> Downloading Prisma engines for windows [====================] 100%

Generating Photon.js to .\node_modules\@prisma\photon
Done in 4.08s

npx: installed 2 in 3.465s
Created files success
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

C:\Users\Jan\Documents\throwaway\1162 (master -> origin)
λ yarn dev:nexus
yarn run v1.17.3
$ ts-node-dev --tree-kill --no-notify --respawn --transpile-only src/main.ts
Using ts-node version 8.4.1, typescript version 3.7.2
� Server ready at http://localhost:4000
Terminate batch job (Y/N)?
^CThe system cannot open the device or file specified.

C:\Users\Jan\Documents\throwaway\1162 (master -> origin)
λ http://localhost:4000

@jlarmstrongiv
Copy link
Author

@janpio Did you go to localhost and try to make a query? I forgot to add that final step. The error occurs on localhost in the graphql playground

@janpio
Copy link
Member

janpio commented Dec 17, 2019

No, I followed the provided steps. Let me know which query to run and how and where (assume I know nothing about nexus and GraphQL).

@pantharshit00
Copy link
Contributor

I am also not able to reproduce this.

I tried some queries and everything is in order:
image

@jlarmstrongiv
Copy link
Author

Yea, we were able to reproduce it 11 times on Monday, but not once after that. The querying seems to work now, but not studio on localhost:5555.

New alphas were released after 2.0.0-alpha.453, but I haven't had time to check and see which versions were installed.

Strange stuff 🤷‍♂

@pantharshit00
Copy link
Contributor

I am going to close this for now. Please comment here or open a new issue if this is still reproducable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants