import.meta.env and tick encapsulated variables
gukii
HOBBYOP

a year ago

import.meta.env needed for uploadthing secret token ecapsulated by ticks.

uploadthing does this strange thing where they encapsulated their secret token with ticks ' .

They access them via import.meta.env.UPLOADTHING_TOKEN.

I tried to use process.env.UPLOADTHING_TOKEN on railway.com but this seems to create issues with those tick-encapsulated variables:

- leaving the ticks in the Variables creates a token that is too long by two chars. I checked, it's too long and uploadthing says so too.

  • Leaving them out creates an invalid token. Accessing uploadthing works fine on localhost, with the tokens set in .env files importing them via import.meta.env.UPLOADTHING_TOKEN.

any ideas?

Solved

1 Replies

gukii
HOBBYOP

a year ago

figured it out. added crypto to vite in app.config.ts:

```

optimizeDeps: {

include: ['node:crypto'],

},

build: {

commonjsOptions: {

transformMixedEsModules: true,

},

},

```


Status changed to Solved sarahkb125 12 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...