File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,21 +17,13 @@ declare const process: { env: Record<string, string | undefined> };
1717const 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 */
2524function 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." ,
You can’t perform that action at this time.
0 commit comments