Skip to content

Commit 3108f54

Browse files
committed
Allow dev auth without deployment env
1 parent 389fd91 commit 3108f54

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

apps/dashboard/convex/dev.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,13 @@ declare const process: { env: Record<string, string | undefined> };
1717
const SESSION_DURATION_MS = 30 * 24 * 60 * 60 * 1000;
1818

1919
/**
20-
* Throws if the current Convex deployment looks like a production deployment,
21-
* or if no deployment env var is set (paranoid: refuse to run in unknown
22-
* environments). Read from `process.env.CONVEX_DEPLOYMENT`, which Convex
23-
* exposes server-side.
20+
* Throws if the current Convex deployment explicitly identifies itself as prod.
21+
* Convex does not automatically expose the local `.env.local` deployment marker
22+
* to function runtime env, so an unset value must still be allowed for dev.
2423
*/
2524
function assertDev(): void {
2625
const deployment = process.env.CONVEX_DEPLOYMENT;
27-
if (deployment === undefined || deployment === "") {
28-
throw new ConvexError({
29-
code: "DEV_ONLY",
30-
message:
31-
"Refusing to run dev mutation: CONVEX_DEPLOYMENT is not set. This function is dev-only.",
32-
});
33-
}
34-
if (deployment.startsWith("prod:")) {
26+
if (deployment?.startsWith("prod:")) {
3527
throw new ConvexError({
3628
code: "DEV_ONLY",
3729
message: "Refusing to run dev mutation against a production deployment.",

0 commit comments

Comments
 (0)