UPLOADTHING_TOKEN ticks don's seem to work on railway.com

I am trying to run uploadthing on an app hosted on railway.com. Railway's management system for environment variables does not work with
import.meta.env.UPLOADTHING_TOKEN
import.meta.env.UPLOADTHING_TOKEN
but works with
process.env.UPLOADTHING_TOKEN
process.env.UPLOADTHING_TOKEN
However, doing this the ticks encapsulating the token cause issues: - if i leave the ticks in the token is too long by 2 characters, uploadthing complains: A token is a base64 encoded JSON object matching { apiKey: string, appId: string, regions: string[] }., ..Length must be a multiple of 4, but is 170 (full error is shown below) - if i remove the ticks, I am getting: Error uploading file Invalid signing secret all these seems to be related to the ticks or their interaction with process.env, as environment variables used with process.env works fine for the database. any ideas on what i can do?
Solution:
figured it out. added node:crypto to vite in app.config.ts: ``` optimizeDeps: { include: ['node:crypto'], },...
Jump to solution
1 Reply
Solution
SantaChris
SantaChris3mo ago
figured it out. added node:crypto to vite in app.config.ts:
optimizeDeps: {
include: ['node:crypto'],
},
build: {
commonjsOptions: {
transformMixedEsModules: true,
},
},
optimizeDeps: {
include: ['node:crypto'],
},
build: {
commonjsOptions: {
transformMixedEsModules: true,
},
},

Did you find this page helpful?