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

Client side JS rendering error re: browser-ponyfill.js does not provide an export named 'default' #449

Closed
2 tasks done
JamesPHoughton opened this issue Dec 4, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@JamesPHoughton
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

After bumping to latest version, running the admin console is fine, but switching to participant view yields a JS error, and a blank page. (Nothing is rendered at all.)

From chrome browser console:

Uncaught SyntaxError: The requested module '/node_modules/cross-fetch/dist/browser-ponyfill.js?v=c60c6b24' does not provide an export named 'default' (at graphql.ts:219:3)

From firefox

Uncaught SyntaxError: ambiguous indirect export: default index.js:4:8

Which corresponds to:

image

From safari:

image

No errors serverside.

Steps To Reproduce

No response

Empirica Version

Version: v1.8.8
SHA:     c2176a6
Branch:  main
Time:    2023-12-03T08:21:53Z

Client:  1.8.8
Server:  1.8.8

What OS are you seeing the problem on?

macOS

What browser are you seeing the problem on?

No response

Relevant log output

No response

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@JamesPHoughton JamesPHoughton added the bug Something isn't working label Dec 4, 2023
@JamesPHoughton
Copy link
Contributor Author

JamesPHoughton commented Dec 5, 2023

Looks like this is something other projects have encountered using graphql and cross-fetch: lquixada/cross-fetch#120 (comment)

Some discussion in other projects about it being related to how the packages are linked: supabase/supabase-js#845 (comment)

@malsobay
Copy link
Contributor

malsobay commented Dec 5, 2023

@JamesPHoughton thanks for the detailed report -- just chiming in to say I'm also facing this. happy to share any diagnostics that are helpful, but I see obvious bases are already covered.

As an aside, is the documentation on changing to a specific version up-to-date? Tried doing $ empirica upgrade --version "version: v1.8.5" to roll back, but got ⠦ Upgrade empirica packages00:46:37.986 FTL empirica: failed to start error="upgrade packages: upgrade client: npm install --silent -E @empirica/core@version: v1.8.5: exit status 1"

Update: it looks like empirica upgrade --version "v1.8.5" works, I'll submit a PR for the docs.

@npaton
Copy link
Contributor

npaton commented Dec 5, 2023

Would mind trying to add the following to you client/package.json and then npm i and try again:

  "overrides": {
    "@empirica/core": {
      "@empirica/tajriba": "1.5.2"
    }
  }

Thanks!

@JamesPHoughton
Copy link
Contributor Author

That worked great - what is it doing?

@npaton
Copy link
Contributor

npaton commented Dec 6, 2023

It forces a new version of tajriba I released, that polyfills fetch on the server. Unfortunately, the 2 libraries that handle browser and node cross platform support for fetch are broken in different ways, when using what they call a "ponyfill", which is where you don't overwrite the global definition of the thing you're trying to patch (here, fetch). So we're going for a full polyfill, which I'd rather not do, but I think it's fine. node-fetch is good. And I don't really have a choice at this point.

I'm releasing a new version with this fix.

@npaton
Copy link
Contributor

npaton commented Dec 6, 2023

This should be fixed in release 1.8.9.

@npaton npaton closed this as completed Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants