#Error no such file or directory.

1 messages · Page 1 of 1 (latest)

sinful obsidian
#

I'm trying to read a json file using readfile.The file is being read in development environment while in production it can't read the json file in that path.

void flare
#

How are you reading the file? How is it being deployed? Are you certain the file exists in production?

sinful obsidian
#

const data = await readFile(join(process.cwd(),'./src/fba/data/amazonFees/referralFee.json'), 'utf8');

#

It is being deployed in vercel

void flare
#

Do you deploy the source code to vercel? Can you verify that that file does indeed exist?

sinful obsidian
#

Yes.

#

File exists i can read it in development

void flare
#

Don't care about development. We're talking about where the issue is: production

void flare
#

Dunno, I don't use vercel. Normally I'd suggest ssh-ing into your production server and checking the files that exist. No clue if vercel gives you that ability though

sinful obsidian
#

What do you use for deployment?

void flare
#

AWS or GCP usually

#

Or Digital Ocean

sinful obsidian
#

Is there any guide?

#

I'm new to aws

#

or gcp

void flare
#

For any of them, look up Typescript NodeJS deployed to <provider>. It's pretty much the same as those

sinful obsidian
#

Ok thank you.

#

Will check.

sinful obsidian
#

Heey

#

Is there any easier way to deploy other than aws or gcp

void flare
#

Easier than?

sinful obsidian
#

I tried in railway too

#

ENOENT: no such file or directory, open '/app/src/fba/data/amazonFees/fixedClosingFee.json'
Error: ENOENT: no such file or directory, open '/app/src/fba/data/amazonFees/fixedClosingFee.json'

#

Same error

void flare
#

I'll say it again: that means the file doesn't exist

sinful obsidian
#

Is there any way to find the correct path in production?

void flare
#

That would all depend on the deployment process. I don't know what you're deploying, or how vercel or railway work under the hood, so I can't say

sinful obsidian
#

I'm so so sorry for taking your time.

#

It was a typo

#

In one of the file

#

I should have wrapped everything in try catch