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

Open
wants to merge 1 commit into
base: main
Choose a base branch
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

config.loggerProvider.debug(
'Network connectivity checker plugin is disabled because navigator is not available.',
);
config.offline = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this needs to be defaulted to true? If navigator isn't available, then we want to default to assuming there's internet connectivity? Offline mode is mostly best effort.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. FIxing now

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