#Actions execute twice

1 messages · Page 1 of 1 (latest)

silver crater
#

I've been noticing that a fetch() call from an action seems to run twice.

For context, I'm sending a message using an external API. I have a helper function that calls fetch(). An action runs that helper function.

In logs, I see only the action running once. However, the message is sent twice and it has different content on each send. Since I'm generating the reply by calling gpt3.5, it seems like the whole action ran again even if the logs don't show it.

Any ideas?

#

This is the only log

eager copper
#

Is React involved at any point in this process?

mild dock
#

How is the action invoked? Is it scheduled or invoked from React via useAction?

silver crater
#

not invoked by React. It's a runAction from a webhook.

#

This is all invoked by the runAction in the third to last log POST /hostaway/webhook

silver crater
#

FYI, this double message behaviour occurs intermittently. I would say for 1/5 messages.

visual gazelle
#

Huh. That is very strange given we explicitly don't retry actions anywhere. Just to confirm, I got all the symptoms correct. You are calling an action from a webhook. You are positive the webhook is only called once. The logs are all correct in that everything is only logged once, but somehow the actions seem to run insert the message twice? And it seems like the whole actions is run twice?

Is that a Node.js action or it runs in Convex javascript environment?

turbid tinsel
#

It looks like the webhook is taking just over 10s. Is it possible the service calling the webhook gives up after 10s and retries it?

One thing you might notice is funny ordering - the logs from an action may be posted after the logs from the mutations / queries it runs.

silver crater
silver crater
#

Let me get back to this tonight after some more thorough testing

silver crater
#

Resolved.

Webhook was misconfigured and fired to both prod and dev instances. False alarm 😅