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

register fails with ReferenceError: regeneratorRuntime is not defined #3

Closed
will-ks opened this issue Nov 7, 2022 · 11 comments
Closed

Comments

@will-ks
Copy link

will-ks commented Nov 7, 2022

Calling Pushy.register with this code:

const deviceToken = await Pushy.register({
          appId: '[my-app-id]',
        })

results in the following error:

Uncaught (in promise) ReferenceError: regeneratorRuntime is not defined
    at pushy-sdk-npm.js:1:1
    at f (pushy-sdk-npm.js:1:1)
    at new i (pushy-sdk-npm.js:1:1)
    at Object.register (pushy-sdk-npm.js:1:1)
    at _callee$ (EnableNotificationsStep.tsx:28:1)
@pushy
Copy link
Owner

pushy commented Nov 9, 2022

Hi @will-ks,
Thanks for reaching out. We'd be glad to assist.

It seems a dependency is missing. Please try the solution mentioned in this article, and let us know if it resolves the issue.

@pushy
Copy link
Owner

pushy commented Aug 31, 2023

Closing due to lack of activity.

@pushy pushy closed this as completed Aug 31, 2023
@jgarplind
Copy link

This appears to still be an issue.

While the suggested solution* works, I don't think it should be the consumer's concern to install packages that are required to make Pushy work.

*npm i regenerator-runtime followed by import 'regenerator-runtime/runtime' at the top of the file that uses Pushy

@pushy
Copy link
Owner

pushy commented Jan 11, 2024

Hi @jgarplind,
Thanks for reaching out and for confirming you're still facing this issue.

We've just released version 1.0.15 of the Pushy Web SDK which now includes babel-polyfill as a dependency of the npm package. This should effectively resolve the issue you encountered.

Please install version 1.0.15 of the Pushy Web SDK from npm using the following command:

npm install pushy-sdk-web@latest --save

Please give it a try, and let us know if there's anything else we can help with.

@noe-david
Copy link

Hi! Colleague of @jgarplind here :)

We just updated the package, but unfortunately this introduced another issue:

Uncaught TypeError: Cannot read properties of undefined (reading '_babelPolyfill')
    at Object.<anonymous> (pushy-sdk-npm.js:2:18816)
    at Object.<anonymous> (pushy-sdk-npm.js:2:19294)
    at e (pushy-sdk-npm.js:1:320)
    at Object.<anonymous> (pushy-sdk-npm.js:1:708)
    at e (pushy-sdk-npm.js:1:320)
    at pushy-sdk-npm.js:1:413
    at pushy-sdk-npm.js:1:417
    at pushy-sdk-npm.js:1:81
    at ../node_modules/.pnpm/pushy-sdk-web@1.0.15_webpack@2.7.0/node_modules/pushy-sdk-web/dist/pushy-sdk-npm.js (pushy-sdk-npm.js:1:190)
    at __require2 (chunk-BYPFWIQ6.js?v=475eb560:19:50)

Any ideas?

@pushy
Copy link
Owner

pushy commented Jan 12, 2024

Hi @noe-david,
We'd be glad to further assist.

Can you please advise what kind of web framework you're using? Is it React/Angular/Vue or something else?

@noe-david
Copy link

Great!

We're using React with Vite.

@pushy
Copy link
Owner

pushy commented Jan 12, 2024

Hi @noe-david,
Thanks for letting us know! We've been able to reproduce and fix the issue in commit b0bff86.

We've just released version 1.0.16 of the Pushy Web SDK which directly consumes the Pushy JS module.

Please install version 1.0.16 of the Pushy Web SDK from npm using the following command:

npm install pushy-sdk-web@latest --save

Please give it a try, and let us know if there's anything else we can help with.

@noe-david
Copy link

Hey again! Thanks for being on this!

I installed the patch and ran the dev server and got this:

✘ [ERROR] Could not resolve "promise-polyfill"

    ../node_modules/.pnpm/pushy-sdk-web@1.0.16/node_modules/pushy-sdk-web/src/lib/pushy.js:7:20:
      7 │ import Promise from 'promise-polyfill';
        ╵                     ~~~~~~~~~~~~~~~~~~

  You can mark the path "promise-polyfill" as external to exclude it from the bundle, which will
  remove this error and leave the unresolved path in the bundle.

✘ [ERROR] Could not resolve "whatwg-fetch"

    ../node_modules/.pnpm/pushy-sdk-web@1.0.16/node_modules/pushy-sdk-web/src/util/api.js:1:7:
      1 │ import 'whatwg-fetch';
        ╵        ~~~~~~~~~~~~~~

  You can mark the path "whatwg-fetch" as external to exclude it from the bundle, which will remove
  this error and leave the unresolved path in the bundle. 

@pushy
Copy link
Owner

pushy commented Jan 16, 2024

Hi @noe-david,
You're welcome! Thanks for letting us know you're still facing an issue.

This has now be resolved in commit 2310d31 and published to npm in version 1.0.17.

Please install version 1.0.17 of the Pushy Web SDK from npm using the following command:

npm install pushy-sdk-web@latest --save

Please give it a try, and let us know if there's anything else we can help with.

@noe-david
Copy link

Perfect! That solved it 👍

Thanks for your commitment @pushy team!

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

No branches or pull requests

4 participants