false positive "Date.now() isn't currently supported within workflows." when testing workflow
I'm hitting a
→ Date.now() isn't currently supported within workflows. error, even though there's no call to Date.now() in my code
the test is this:
and start workflow is this:
I see that there's a new Date() call, but if I just put an empty string I still have this error.
I'm using bun with vitest, setup as close as possible as documented.
6 Replies
alright here's a full example that causes the error:
dependencies used:
- "vitest": "^3.2.4"
- "convex-test": "^0.0.38",
- "convex": "^1.27.0",
- "convex-helpers": "^0.1.104",
- "@convex-dev/aggregate": "^0.1.23",
- "@convex-dev/auth": "^0.0.88",
- "@convex-dev/migrations": "^0.2.9",
- "@convex-dev/react-query": "0.0.0-alpha.11",
- "@convex-dev/workflow": "^0.2.6",
- "@convex-dev/workpool": "^0.2.18",
- "@edge-runtime/vm": "^5.0.0",
if you need more info I'll happily provide it
Have you managed to fix that?
You're calling
new Date() here, which calls Date.now() afaik
line 116
I don't know if that counts as in a workflow, since it's inside the test? but idk
in my case i was trying to start a workpool.enqueue within the workflow
i've solved moving the enqueue into a onCompleted action
i'm using workflow for processing with AI, then i have a pool for my messaging logic (sending whatsapp, sms and etc)
Hello, sorry for replying this late!
I initially thought that aswell, but in my second example that I did provide there aren't any new Date() calls, and yet it also fails.
As far as I remember it did still error
no 🙁