-
Notifications
You must be signed in to change notification settings - Fork 20
Doesn't work with Next.js in APIs (events seem sent but aren't available on Amplitude dashboard) #123
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Expected Behavior
Event sent using @amplitude/node should be available on the Amplitude Dashboard
Current Behavior
Events aren't available in Amplitude, as if they were never received.
Logs:
info - ready on http://localhost:8888
2021-06-22T18:09:53.157Z [modules/core/amplitude/amplitudeServerClient] Logging Amplitude event "api-invoked" with properties: { apiEndpoint: 'status' }
2021-06-22T18:09:53.157Z [modules/core/amplitude/amplitudeServerClient] NodeClient {
_events: [],
_responseListeners: [],
_flushTimer: null,
_apiKey: '5ea02d86a6840c165fcc01377131fa13',
_options: {
serverUrl: 'https://api2.amplitude.com/2/httpapi',
debug: true,
maxCachedEvents: 16000,
logLevel: 3,
optOut: false,
retryTimeouts: [
100, 100, 200, 200,
400, 400, 800, 800,
1600, 1600, 3200, 3200
],
retryClass: null,
transportClass: null,
uploadIntervalInSec: 0,
minIdLength: null
},
_transportWithRetry: RetryHandler {
_apiKey: '5ea02d86a6840c165fcc01377131fa13',
_options: {
serverUrl: 'https://api2.amplitude.com/2/httpapi',
debug: true,
maxCachedEvents: 16000,
logLevel: 3,
optOut: false,
retryTimeouts: [Array],
retryClass: null,
transportClass: null,
uploadIntervalInSec: 0,
minIdLength: null
},
_transport: HTTPTransport {
options: [Object],
_uploadInProgress: false,
_requestQueue: [AsyncQueue],
module: [Object]
},
_idToBuffer: Map(0) {},
_eventsInRetry: 0
}
} 5ea02d86a6840c165fcc01377131fa13
response {
status: 'success',
statusCode: 200,
body: {
eventsIngested: 0,
payloadSizeBytes: 58,
serverUploadTime: 1624385394010
}
}
The API key is defined, the response is sent and awaited for, the result is a success, but there are no data in the Amplitude Dashboard. The @amplitude/react-amplitude package works fine on the browser, though.
It doesn't work locally, and it doesn't work on Vercel either.
I'm not sure what's wrong.
Possible Solution
Potentially related to flushing and https://vercel.com/docs/platform/limits#streaming-responses, but I've flushed and awaited for the flush to avoid any issue. Also, it doesn't even work locally.
Steps to Reproduce
git clone git@github.com:UnlyEd/next-right-now.git nrn-refactor-amplitude && cd nrn-refactor-amplitude && git checkout refactor-amplitude && cp .env.local.example .env.local && yarn && yarn start- Go to
localhost:8888/api/statusand look at the server console
Environment
- SDK Version: "@amplitude/node": "1.6.1",
- Node version: v14
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working

