Trouble accessing Environment Variables using Deno

Hi,

I am running a cron job that’s a Deno script. I set it up using the advice from this thread:

I chose Node as the runtime environment.

For the build command I have:

curl -fsSL https://deno.land/install.sh | sh

For the command I have:

export PATH="$DENO_INSTALL/bin:$PATH" && deno task start

In Environment I have DENO_INSTALL set to /opt/render/project/.deno

I also have a few other Environment Variables that my script needs.

When I “Trigger Run” manually, the script works. It looks like this:

Nov 6 04:23:16 PM  ==> Running 'export PATH="$DENO_INSTALL/bin:$PATH" && deno task start'
Nov 6 04:23:16 PM  Task start deno run --allow-read --allow-env --allow-net main.ts
... the script works

However, when the cron job runs automatically my script runs but it fails because it does not have access to the environment variables.

Is there some reason the environment variables would be available when I do “Trigger Run” but would not be available when cron runs the script automatically?

Thanks!

Hi Toby,

Environment variables set should be available, can you use the SHELL tab to echo %VAR_NAME to make sure it’s there,

As you’ve opened this on community and not from your Render account we can’t provide much support - for service specific questions it’s always best to contact our team directly from dashboard,

Regads,

John B
Render Support, UTC :uk:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.