amplitude / amplitude/Amplitude-TypeScript
Initiating Amplitude SDK in _app.js Breaks Pages with SSR (Next js)
- 主要语言
- TypeScript
- 星标
- 180
- 派生
- 68
- 平均合并
- 3 天 1 小时
- 30 天内合并 PR
- 29
描述
## Expected Behavior:
The Next App example for shows that users should be able to be initiate amplitude in the _app.js file using the following code:
`amplitude.init(AMPLITUDE_API_KEY);`
## Current Behavior
If you have pages that use the `getServerSideProps` function, calling amplitude.init() in the root file causes these pages to throw a 500 error when accessing them. I suspect this is because of an incompatibility with Server Side Rendering.
Steps to reproduce:
1. Add the init function call to _app.js file. `amplitude.init(AMPLITUDE_API_KEY);`
2. Create a page that uses the getServerSideProps function.
3. Run the Next.js development server and observe the behavior when navigating to the page from step 2.
## Environment
- JS SDK Version: "@amplitude/analytics-browser": "^2.2.0",
- Installation Method: npm
贡献指南
评估
这个 Issue 还没有评估数据。