pwa-studio: Could not find a schema at lastCachedGraphQLSchema.json

I run the “yarn run build” command and I faced that given below issue. Please help me out. Thanks:-

:/var/www/html/magento23/pwa-studio$ yarn run build
yarn run v1.15.2
$ yarn workspaces run build
$ echo 'Skipping graphql-cli-validate-magento-pwa-queries build...'
Skipping graphql-cli-validate-magento-pwa-queries build...
$ concurrently --raw yarn:build:cjs yarn:build:esm
$ BABEL_ENV=development babel src --out-dir esm --root-mode 'upward' --source-maps
$ BABEL_ENV=production babel src --out-dir dist --root-mode 'upward' --source-maps
Successfully compiled 32 files with Babel.
Successfully compiled 49 files with Babel.
$ yarn run clean
$ rimraf dist
$ babel src --out-dir dist --root-mode 'root' --source-maps --copy-files
Successfully compiled 16 files with Babel.
$ yarn run clean && yarn run build:esm && yarn run validate-queries && yarn run build:prod
$ rimraf dist esm
$ BABEL_ENV=development babel src --out-dir esm --root-mode 'upward' --source-maps --copy-files
Successfully compiled 290 files with Babel.
$ yarn run download-schema && graphql validate-magento-pwa-queries --project venia
$ graphql get-schema --project venia
⚠ maximum redirect reached at: http://magento.local2/admin_rx200y/admin/index/index/key/d82ea5208d0cc660efbf78d01e078c0004844e19a1ad9079f8d58196170a9eea/
Validating GraphQL queries in venia project...
✖ An error occurred:
Could not find a schema at lastCachedGraphQLSchema.json.
 Run 'graphql get-schema --project venia' to download the schema before running validate-magento-pwa-queries.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/bin/node
Arguments: /usr/share/yarn/lib/cli.js build
Directory: /var/www/html/magento23/pwa-studio/packages/venia-concept
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspaces for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

Screenshots Screenshot from 2019-03-22 21-54-52 Screenshot from 2019-03-22 21-55-56

Please complete the following device information:

  • Ubuntu - 18.04
  • Magento Version - 2.3
  • Yarn v 1.15.2
  • NPM version npm -v - 6.7
  • Node Version node -v - 11.12

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 32 (14 by maintainers)

Most upvoted comments

@LucasCalazans - It appears we’re not allowing insecure backends in query validation, which is why you’re seeing this error. I think it’s reasonable to add the insecure: true flag to packages/venia-concept/.graphqlconfig so this validation works with self-signed certificates, especially since we only expect to validate queries in development environments (skipped in production builds). I’ll update the issue description with this proposed fix.

In the meantime, if you change your MAGENTO_BACKEND_URL to http, this should get around the error, or you can manually add this flag to .graphqlconfig.

Edit: I’m actually going to create a new issue for this, since it’s different from the originally reported issue and few other comments in this thread. See #1311.

I think that the error I’m getting is the same reported:

✖ An error occurred:
Could not find a schema at lastCachedGraphQLSchema.json.

Edit: Yes, this error was about the certificate. I’ve changed to HTTP and it has worked. Thanks @tjwiebell

Same issue here. Magento -> 2.3.1 PWA-Studio -> develop SO -> Fedora 26

After running yarn run build

yarn run v1.16.0
$ yarn workspaces run build
$ cp ../../magento-compatibility.js ./lib/
$ concurrently --raw yarn:build:cjs yarn:build:esm
$ BABEL_ENV=production babel src --out-dir dist --root-mode 'upward' --source-maps
$ BABEL_ENV=development babel src --out-dir esm --root-mode 'upward' --source-maps
Successfully compiled 44 files with Babel.
Successfully compiled 70 files with Babel.
$ yarn run clean
$ rimraf dist
$ babel src --out-dir dist --root-mode 'root' --source-maps --copy-files
Successfully compiled 12 files with Babel.
$ yarn run clean && yarn run build:esm && yarn run validate-queries && yarn run build:prod
$ rimraf dist esm
$ BABEL_ENV=development babel src --out-dir esm --root-mode 'upward' --source-maps --copy-files
Successfully compiled 312 files with Babel.
$ yarn run download-schema && graphql validate-magento-pwa-queries --project venia
$ graphql get-schema --project venia
⚠ request to https://magento-pwa.localhost/graphql failed, reason: certificate has expired
Validating GraphQL queries in venia project...
✖ An error occurred:
Could not find a schema at lastCachedGraphQLSchema.json.
 Run `graphql get-schema --project venia` to download the schema before running validate-magento-pwa-queries.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /home/me/.nvm/versions/node/v10.15.1/bin/node
Arguments: /usr/share/yarn/lib/cli.js build
Directory: /home/me/projects/magento-pwa/venia/packages/venia-concept
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspaces for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

And the which graphql return:

/usr/bin/which: no graphql in (/home/me/.nvm/versions/node/v10.15.1/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin:/home/me/.local/bin:/home/me/bin)

stat node_modules/.bin/graphql:

  File: node_modules/.bin/graphql -> ../graphql-cli/dist/bin.js
  Size: 26        	Blocks: 0          IO Block: 4096   symbolic link
Device: fd00h/64768d	Inode: 5005697     Links: 1
Access: (0777/lrwxrwxrwx)  Uid: ( 1000/me)   Gid: ( 1000/me)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2019-06-07 11:23:11.961004026 -0300
Modify: 2019-06-07 11:23:11.961004026 -0300
Change: 2019-06-07 11:23:11.961004026 -0300
 Birth: -

@sirugh thanks for reply, i figured out that issue on morning and it is running fine. Just i changed MAGENTO_BACKEND_URL - magento admin url to magento site url. Thanks