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

fix(analytics-browser): prevent error being thrown when server-side rendering #721

Closed
wants to merge 1 commit into from

Conversation

johnf
Copy link

@johnf johnf commented Apr 18, 2024

Summary

Fixes #710 - I'm not sure why, but this library gets pulled into the SSR part of my next.js project.
Likely a treeshaking issue. It then throws and error because navigtator is missing.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

@johnf johnf marked this pull request as draft April 18, 2024 05:16
@johnf johnf marked this pull request as ready for review April 18, 2024 05:33
@piyushchauhan2011
Copy link

piyushchauhan2011 commented Apr 23, 2024

Looks okay to me, hopefully we can merge these changes so it will be helpful to utilize them soon

@johnf
Copy link
Author

johnf commented Jun 26, 2024

@izaaz Any chance of getting this merged?

@johnf
Copy link
Author

johnf commented Aug 15, 2024

@izaaz I've added some extra places where SSR causes issues

@izaaz
Copy link
Contributor

izaaz commented Sep 17, 2024

@johnf - created a new PR for this #876

For the other two plugin changes, we've already made changes to use getGlobalScope()?.addEventListener instead of window.addEventListener which should have fixed those problems already. Can you please take a look at the other PR and approve it if it looks good?

@johnf
Copy link
Author

johnf commented Sep 17, 2024

Closing in favour of #876

@johnf johnf closed this Sep 17, 2024
@izaaz
Copy link
Contributor

izaaz commented Sep 26, 2024

@johnf this should be now available in version 2.11.7. Please let me know if you run into issues

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

Successfully merging this pull request may close these issues.

Amplitude SDK integration with NextJS Pages Router
3 participants