import.meta.env and tick encapsulated variables
gukii
HOBBYOP

9 months 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

9 months 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 9 months ago


Loading...