NODE_ENV always equates to 'development'
There must be something I don't know since NODE_ENV always equates to 'development' regardless of its value. In "use node" functions it works as expected. This happens both in convex development and production environments.
4 Replies
Right now we don't change the node_env value.
If you need to distinguish your backends, I'd suggest you set up your environment variable with whatever values you need (this has the added benefit of allowing you to easily test your "prod" setup on your "dev" backend).
Thanks for the answer Michal, yes was wondering if it was automatically handled by you but ok the cause must be somewhere else, maybe nextjs's. Temporarily solved by calling the variable "CONVEX_ENV"; needed to distinguish the environments for stripe checkouts.
Can I ask you one more thing? Is it normal behaviour that I can't destructure single item queries?
Gives me type error:
"Property '_id' does not exist on type '{ _id: Id<"subscriptions">; _creationTime: number; ...."
The query returns
Doc<"subscriptions"> | null
, so you cannot destructure it because of the null
caseYou can do
const { _id} = (await ctx.db....unique())!;
if you want to assume its existence
it'll just throw a less useful error at runtime if it's missing