Go lambda functions called twice

I am new programing with lambda functions. After some research this seems to be a general problem with aws lambda functions sometimes (and this is where I don’t know how to start debugging) While calling one of my function, I noticed it is executed twice.
I’m using these functions as a login (first function) and callback (second) for an auth2 authent.
The problem here is that I’m generating a random state token and storing it in mongoDB, this works fine but since it creates two tokens, I can only delete one after using it.

At first I thought it was because of “OPTIONS”, but I noticed this behaviour was rather random. Judging by the logs I can’t see anything abnormal besides the double exec :

11:13:04 AM: New state token generatedTHis was called from :  GET
11:13:04 AM: Duration: 2256.36 ms	Memory Usage: 51 MB	Init Duration: 214.05 ms	
11:13:06 AM: New state token generatedTHis was called from :  GET
11:13:06 AM: Duration: 2046.06 ms	Memory Usage: 51 MB	

Any light on this issue would be appreciated !

Still having this issue, any help would be appreciated please. :smiley:

Can you provide a link to a lambda function that is experiencing this issue? And also a link to the page invoking the function? I’d like to test directly to see why the function may be triggering twice. Thanks!

I am also experiencing this issue with Netlify lambda functions. I noticed this only as the function sends out an SMS notification and was doing so twice in rapid succession. At first I assumed I was invoking the function twice in error but no, it’s most definitely only the once.

The function is as follows
https://cryptomint.one/api/addRecipientAddress/:address/:txHash
and invoking it executes it twice about 600ms apart, which is likely the execution time.

Could you try to log a random value or something like Date.now() in your lambda to confirm the suspicion?