-
Notifications
You must be signed in to change notification settings - Fork 20
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
Doesn't work with Next.js in APIs (events seem sent but aren't available on Amplitude dashboard) #123
Comments
Also, the UX on the server isn't great, because you're making either device_id or user_id required, but most of the time I don't know what's the device (it's an API call, there is no device) and sometimes I have no way to know who's the user either. I think none of those fields should be required for server-side usage. They should both be optional. |
Okay, so it looks like it was because the call worked (200 response) but And this is because of the user/device issue. I had to specify a |
I've fixed it at But this doesn't seem great, Amplitude now believes all events are related to the same user, which isn't really the case. So I'll rather use a dynamic UUID value as default user_id to counter this behavior. I wish this had been explained in the README, I've lost a whole day on this. |
I'd like to know if it's necessary to await the |
Hi @Vadorequest, great to hear you solved the problem on your own.
|
I was asking in relation to https://vercel.com/docs/platform/limits#streaming-responses. I understand I need to await it if I want to do anything with the Ideally, I'd rather not await when calling |
@Vadorequest |
Yes, exactly.
…On Tue, Jun 22, 2021, 22:30 Alyssa Yu ***@***.***> wrote:
@Vadorequest <https://github.com/Vadorequest>
To clarify your question,
Do you mean your platform is deployed by Vercel. And you are curious if
Vercel does not support streaming responses will affect how you use
Amplitude-Node and if you must add await when calling flush or logEvent?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#123 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5BRYR4DECLUZEOZJRDX6TTUDXGVANCNFSM47EHW46A>
.
|
I've opened a related issue on Next.js to try to figure out the pros/cons and best practices regarding all of this. vercel/next.js#26523 |
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:
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 [email protected]: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
localhost:8888/api/status
and look at the server consoleEnvironment
The text was updated successfully, but these errors were encountered: