Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Issue deploying GraphQL API with Sanity, resolved by removing a plugin

14 replies
Last updated: Dec 23, 2022
Hey everyone, I’m trying to deploy the graphql api using
sanity graphql deploy
and getting this error. The studio works perfectly tho.
Dec 22, 2022, 6:59 PM
user G
! What version of the Studio and CLI are you running?
Dec 22, 2022, 7:08 PM
@sanity/cli version 3.1.2
sanity ^3.1.2
Dec 22, 2022, 7:32 PM
That’s my
  "name": "cms",
  "private": true,
  "version": "1.0.0",
  "main": "package.json",
  "license": "UNLICENSED",
  "scripts": {
    "dev": "sanity dev",
    "start": "sanity start",
    "build": "sanity build",
    "deploy-graphql": "sanity graphql deploy",
    "pull-env": "vercel env pull -y"
  "dependencies": {
    "@sanity/icons": "^2.1.0",
    "@sanity/vision": "^3.1.2",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-is": "^18.2.0",
    "sanity": "^3.1.2",
    "sanity-plugin-asset-source-unsplash": "^1.0.1",
    "sanity-plugin-graph-view": "^2.0.1",
    "sanity-plugin-media": "^2.0.2",
    "styled-components": "^5.2.0"
  "devDependencies": {
    "@sanity/eslint-config-studio": "^2.0.1",
    "eslint": "^8.6.0",
    "prettier": "^2.8.1",
    "typescript": "^4.0.0"
  "prettier": {
    "semi": false,
    "printWidth": 100,
    "bracketSpacing": false,
    "singleQuote": true
Dec 22, 2022, 7:37 PM
What does your
look like?
Dec 22, 2022, 7:59 PM
import {defineCliConfig} from 'sanity/cli'

const sanityCliConfig = defineCliConfig({
  api: {
    projectId: 'obhirpvy',

export default sanityCliConfig
Dec 22, 2022, 8:00 PM
Can you try adding a graphql config?
import {defineCliConfig} from 'sanity/cli'

const sanityCliConfig = defineCliConfig({
  api: {
    projectId: 'obhirpvy',
    dataset: <dataset-name-here>
  graphql: [{
    tag: "default",
    playground: true,
    generation: "gen3",
    nonNullDocumentFields: false,

export default sanityCliConfig
Dec 22, 2022, 8:06 PM
I did. Same thing
Dec 22, 2022, 8:21 PM
I did see somewhere in the docs that said there might be isssues where some code will try to execute in a browser env leading to window not defined. Would you happen to know anything about that?
Dec 22, 2022, 8:23 PM
Hmm, it'd be unlikely that's the issue with this case but the fact that the error is mentioning HTML canvas could indicate that that's the issue. Are you able to share your Studio's repo?
Dec 22, 2022, 8:24 PM
Unfortunately not. It’s a private organizational repo 😐
Dec 22, 2022, 8:27 PM
No worries. Just to test if it is a browser environment thing, can you try adding a
flag to your deploy command?
Dec 22, 2022, 8:30 PM
I can. I’ll lyk
Dec 22, 2022, 8:31 PM
user M
Hey, It turns out there’s an
which was causing it. Deleting the plugin fixed my issue.
Dec 23, 2022, 2:41 PM
Glad you fixed it! And thanks for sharing your solution!
Dec 23, 2022, 4:28 PM

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.

Was this answer helpful?