ampp
ampp•12mo ago

Importing environment variables into tests.

This might not be a convex issue, but i sure couldn't get it working after a lot of searching and gpt's. I want to run tests on convex actions that call the clerk backend sdk. And i get a missing key error. Wondering if anyone else has managed to get this working.
2 Replies
Michal Srb
Michal Srb•12mo ago
Have you tried:
process.env.CLERK_SECRET = "foobar"
process.env.CLERK_SECRET = "foobar"
before calling your action? If you have Clerk SDK initialized in module scope, outside of an action, then you will have to do this before calling convexTest().
ampp
amppOP•12mo ago
Thanks! that worked, its awesome. Now i got webhooks coming back creating things outside the "test" 😅

Did you find this page helpful?