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

TypeError: window.URL.createObjectURL is not a function #5

Open
ehowey opened this issue Nov 1, 2020 · 10 comments · Fixed by kallyas/safe-courier#70 or kallyas/safe-courier#82 · May be fixed by guillemgarciagomez/slopeer#27

Comments

@ehowey
Copy link

ehowey commented Nov 1, 2020

Hello!

I was hoping to use this in lieu of the Google Maps input. The studio is building fine and looks good but as soon as I run sanity graphql deploy I get this strange error:

TypeError: window.URL.createObjectURL is not a function
    at define (~/coding/mindmapbc/sanity-studio/node_modules/mapbox-gl/dist/mapbox-gl.js:106:41)
    at ~/coding/mindmapbc/sanity-studio/node_modules/mapbox-gl/dist/mapbox-gl.js:116:1
    at ~/coding/mindmapbc/sanity-studio/node_modules/mapbox-gl/dist/mapbox-gl.js:84:81
    at Object.<anonymous> (~/coding/mindmapbc/sanity-studio/node_modules/mapbox-gl/dist/mapbox-gl.js:87:2)

Which based on the googling that I have done seems to be something to do with mapbox and testing? See this issue:

mapbox/mapbox-gl-js#3436

Here is my are my dependencies in case it helps:

  "dependencies": {
    "@sanity/base": "^2.0.7",
    "@sanity/code-input": "^2.0.5",
    "@sanity/color-input": "^2.0.5",
    "@sanity/components": "^2.0.7",
    "@sanity/core": "^2.0.5",
    "@sanity/dashboard": "^2.0.5",
    "@sanity/default-layout": "^2.0.7",
    "@sanity/default-login": "^2.0.5",
    "@sanity/desk-tool": "^2.0.8",
    "prop-types": "^15.6",
    "react": "^16.2",
    "react-dom": "^16.2",
    "react-icons": "^3.11.0",
    "sanity-plugin-dashboard-widget-document-list": "^0.0.11",
    "sanity-plugin-mapbox-input": "^0.0.3",
    "sanity-plugin-media": "^0.4.0"
  },
  "devDependencies": {}
}

And sanity.json stuff

"plugins": [
    "@sanity/dashboard",
    "@sanity/base",
    "@sanity/components",
    "@sanity/default-layout",
    "@sanity/default-login",
    "@sanity/desk-tool",
    "@sanity/color-input",
    "@sanity/code-input",
    "dashboard-widget-document-list",
    "dashboard-widget-structure-menu",
    "media",
    "mapbox-input"
  ],
  "parts": [
    {
      "name": "part:@sanity/base/schema",
      "path": "./schemas/schema.js"
    },
    {
      "name": "part:@sanity/desk-tool/structure",
      "path": "./structure/deskStructure.js"
    },
    {
      "implements": "part:@sanity/dashboard/config",
      "path": "./dashboard/dashboardConfig.js"
    }
  ]
@meshalc
Copy link

meshalc commented Dec 17, 2020

I am also getting the same.

@jamaljeantobias
Copy link

I just started getting the same. Any updates on this?

@doigo
Copy link

doigo commented Feb 9, 2021

Same issue here

@Grsmto
Copy link
Owner

Grsmto commented Feb 10, 2021

I just tried the plugin again on a fresh Sanity Studio install and it worked just fine, couldn't replicate this issue :/
I'm not sure where this comes from tbh!

@jedifunk
Copy link

I am also now getting this error when i try to run sanity graphql deploy

@meshalc
Copy link

meshalc commented Mar 23, 2021 via email

@dreamyguy
Copy link

dreamyguy commented Jan 5, 2022

I got the same error, and was able to establish that the inclusion of @sanity/color-input is what caused it (the commit right before the one that introduced it did not trow the error).

Anyone knows how to circumvent this? We need the input, but we also need to deploy the dataset! 😅

@dreamyguy
Copy link

dreamyguy commented Jan 5, 2022

Fingers crossed that the mapbox-gl-js team will approve my PR and solve this issue! 🤞

mourner pushed a commit to mapbox/mapbox-gl-js that referenced this issue Jan 13, 2022
…ot a function' error. Fixes Grsmto/sanity-plugin-mapbox-input#5. Fixes #11390. (#11370)

* Better validation against 'TypeError: window.URL.createObjectURL is not a function' error

* Validate 'window' only after checking if it's not undefined

* Validate using ES5 syntax to avoid 'invalid token' error when importing the module
@dreamyguy
Copy link

dreamyguy commented Feb 2, 2022

This error should go away now that mapbox-gl-js has released the change on their v2.7.0. 🎉

https://github.com/mapbox/mapbox-gl-js/releases/tag/v2.7.0.

The fix here is to get the dependency that uses mapbox-gl-js to point to the new version.

@pierrenel
Copy link

Hmmm some dep somewhere hasn't been bumped yet - still seeing this on a fresh install 🤔

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