Skip to content
This repository was archived by the owner on Feb 11, 2021. It is now read-only.

Uncaught TypeError: Cannot set property 'query' of undefined #101

Open
jonybekov opened this issue Nov 20, 2019 · 12 comments
Open

Uncaught TypeError: Cannot set property 'query' of undefined #101

jonybekov opened this issue Nov 20, 2019 · 12 comments

Comments

@jonybekov
Copy link

jonybekov commented Nov 20, 2019

Console throws an error when I build my project and run gatsby serve.
Uncaught TypeError: Cannot set property 'query' of undefined
image

Neither swiper carousel nor bootstrap navbar toggle is working in production.
In development mode everything works great!

Here's a github link to reproduction of my project
https://github.com/Teo0303/raisense-bug-repro/

Here's my website that has the issue.
https://raisense.uz/

Can anybody ever solved this kind of problem?

*** Edit ***

This problem only appears when I use gatsby-source-prismic-graphql. When I loaded data from local storage and built my project, problem disappeared

@saschb2b
Copy link

With beta2 that is gone. But be aware that some other issues may come see #77

@xndyz
Copy link

xndyz commented Nov 28, 2019

@saschb2b looks like even with the beta, it's breaking other usestaticquerys when you build it. Works find locally.

@saschb2b
Copy link

Yep. Had to refactor everything to use the StaticQuery component

@Duaner
Copy link
Contributor

Duaner commented Nov 29, 2019

Hey, @Teo0303 I don't see any problem when Itry to use your project. I don't understand why you're having this error in gatsby-browser.js though.

Are you performing queries in gatsby-browser?

@pierrenel
Copy link

Having the same issue 👋

@robcalcroft
Copy link

robcalcroft commented Dec 17, 2019

I also am having this issue, you can work around by commenting out the fix and using a forked version of the repo. Not ideal though
@birkir would you accept a PR for the removal of the fix?

EDIT
Anyone wanting a workaround this has worked fine for me till we have a permanent solution: make a copy of the gatsby-browser.js file from gatsby-source-prismic-graphql with the previous fix code commented out / deleted. Add this to your package.json scripts:

"postinstall": "mv PATCHED_GATSBY_BROWSER.js node_modules/gatsby-source-prismic-graphql/gatsby-browser.js && echo '** gatsby-source-prismic-graphql has been patched, only confirmed as working on v3.3.1 test before upgrading **'"

@jayKayEss
Copy link

Hi, I see a v3.4.0 tag in your repo, but it's not published to npm. Does that version include the fix for this? I'm not able to install it directly from github bc. of something to do w/ your package.json setup.

@aodysseos
Copy link

I had the same issue. Building the project for production is causing all JS events like onClick to stop working. I've manage to work around it my using version: 3.4.0-beta.1 and then switching all my useStaticQuery to < StaticQuery />. Hoping for an update soon :)

@justinluk
Copy link

Running into this issue with useStaticQuery also. Using this plugin is quite the frustrating experience.

@mniederm
Copy link

I had the same problem. With version gatsby-source-prismic-graphql": { "version": "3.5.0" it works.

@devfive
Copy link

devfive commented Mar 23, 2020

I have the same issue. Unfortunately 3.5.0 doesn't fix it on my end. Changing to <StaticQuery /> was the only working quick workaround.

@birkir can we have your assistance on this issue?

@Mokto
Copy link

Mokto commented Apr 7, 2020

Same issue here. With the latest version of the plugin. (3.5.0)

indeed works as a temporary&ugly fix. Thanks!

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

No branches or pull requests