Error while deploying GraphQL in a Gatsby project with Sanity
6 replies
Last updated: Jun 12, 2023
R
help sanity + gatsby project
----------------tried to deploy grpahql from sanity but it's also giving error-- ----------
$ sanity graphql deploy
####### Error while doing: _npm run dev from gatsby project_ #############################
warn [sanity] `overlayDrafts` is set to `true`, but no token is given info [sanity] Fetching remote GraphQL schem
ERROR #gatsby-source-sanity_drafts.10001
GraphQL API not deployed - see <https://github.com/sanity-io/gatsby-source-sanity#graphql-api> for more info
$ sanity graphql deploy
Dataset: production
Tag: default
:heavy_check_mark: Checking for deployed API
? Do you want to enable a GraphQL playground? Yes
:heavy_multiplication_x: Generating GraphQL schema
TypeError: window.URL.createObjectURL is not a function
at define (/home/normal/Desktop/rrevif/itc/new test/los-repos-dba-lying-cols-8ab2924a6511/studio/node_modules/mapbox-gl/dist/mapbox-gl.js:25:41)
at /home/normal/studio/node_modules/mapbox-gl/dist/mapbox-gl.js:35:1
at /home/normal/studio/node_modules/mapbox-gl/dist/mapbox-gl.js:3:81
at Object.<anonymous> (/home/normal/studio/node_modules/mapbox-gl/dist/mapbox-gl.js:6:2)
Jun 10, 2023, 11:52 AM
The first error is suggesting you need to specify a token. This will be necessary in conjunction with overlayDrafts.
The second error appears to be coming from a
The second error appears to be coming from a
mapbox-glpackage. I don’t see that package in a brand new Studio, so it’s likely used by a plugin installed after-the-fact. Can you please run
npm ls mapbox-glor
yarn why mapbox-glto find out what’s using it?
Jun 10, 2023, 2:49 PM
R
thanks for the prompt reply, Yes you are right, its an old studio with gatsby.
below is the output of the that cmd
"@sanity/base": "^2.10.5", "@sanity/cli": "^2.36.0", "@sanity/color-input": "^2.2.6", "@sanity/components": "^2.2.6", "@sanity/core": "^2.36.1", "@sanity/default-layout": "^2.10.5", "@sanity/default-login": "^2.10.5", "@sanity/desk-tool": "^2.10.5", "@sanity/google-maps-input": "^2.36.0", "@sanity/production-preview": "^2.2.6", "@sanity/vision": "^2.36.1",
$npm ls mapbox-gl
dca-flying-colours-studio@1.0.0 /home/normal/Desktop/rrevif/itc/new test/los-repos-dba-lying-cols--8ab2924a6511/studio └─┬ sanity-plugin-mapbox-input@0.0.3 ├─┬ react-map-gl-geocoder@2.2.0 │ └─┬ @mapbox/mapbox-gl-geocoder@4.7.0 │ └── mapbox-gl@1.13.2 deduped └─┬ react-map-gl@5.3.19 └─┬ mapbox-gl@1.13.2 └─┬ @mapbox/mapbox-gl-supported@1.5.0 └── mapbox-gl@1.13.2 deduped
Jun 10, 2023, 3:23 PM
R
About overlayDrafts token error , where can get the token from in sanity?
Jun 10, 2023, 3:31 PM
Looks like the window.URL.createObjectURL issue is known. You might be able to resolve it by pinning
mapbox-gl-jsto a later version, per one of the replies toward the end, but this plugin does not appear to be maintained anymore.
Jun 10, 2023, 3:42 PM
You can create a token from the API tab in Manage .
Jun 10, 2023, 3:42 PM
R
Thank you so much, it worked 👏
Jun 12, 2023, 12:56 AM
Sanity– build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.