Solved

Amplitude doesn't work

  • 22 February 2022
  • 2 replies
  • 73 views

I added amplitude event tracking calls next to all my mixpanel event tracking calls in my nodeJS serverless backend, but no events are showing up, and I’m not sure how to fix it as no errors are thrown. 

Here is the event code in JS:

 

amplitudeClient.logEvent({
              event_type: 'EVENT NAME',
              user_id: (60 character long UUIDV4 string),
              ip: '127.0.0.1',
              event_properties: {
                prop1: prop1,

                prop2: prop2
              }
            });

 

😂

icon

Best answer by qingzhuo 25 February 2022, 03:15

View original

2 replies

Userlevel 2
Badge

Hi @b100 This is the doc for Node SDK. Feel free to refer to it.

 

For your issue, is the client has been initialized with correct api key? And maybe put a flush call after logEvent? Normally this would happen automatically, and I wonder if serverless backend affects that.

Userlevel 3
Badge +5

@qingzhuo Thanks for great trouble-shooting questions. As per communication in a zendesk ticket with @b100,  the issue has been solved.

“I was calling the amplitude event tracking calls right before the terminating line in a nodeJS serverless function (res.send()), which would terminate the tracking call before it was completed, which is why it wasn't working.”

Reply