Deployment Help :.)
lucasgomesoficial
HOBBYOP

2 years ago

Hello, I have a problem, the deployment is being done, but the routes don't work, I've already checked my env's, paths, but I can't understand, please I need to deliver this :(

21 Replies

brody
EMPLOYEE

2 years ago

Please provide more details as "does not work" unfortunately doesn't give enough information.


lucasgomesoficial
HOBBYOP

2 years ago

the return should be {ping: pong}, but nothing


brody
EMPLOYEE

2 years ago

That page is absolutely not nothing?

Please read this docs page -

https://docs.railway.app/guides/fixing-common-errors


lucasgomesoficial
HOBBYOP

2 years ago

This service has other routes, I created this simple get, just for testing.
I already checked this and nothing

Attachments


brody
EMPLOYEE

2 years ago

Are you committing your .env file to GitHub?


lucasgomesoficial
HOBBYOP

2 years ago


brody
EMPLOYEE

2 years ago

Please attach your deployment logs -

https://bookmarklets.up.railway.app/log-downloader/


lucasgomesoficial
HOBBYOP

2 years ago

I don't understand, I don't know this tool, add it to the browser's fav, what now?


brody
EMPLOYEE

2 years ago

Please follow the 3 steps.


lucasgomesoficial
HOBBYOP

2 years ago

Dude, I'm sorry for my limitation, but I couldn't understand, step 2, where is it to open? You talked about the log, follow the print of the log

Attachments


brody
EMPLOYEE

2 years ago

The screenshot is sufficient.

You should never use a file watcher when on Railway and especially not try to load a .env file.

Please add a proper start script to your package.json and remove the dev command from within your service settings.


lucasgomesoficial
HOBBYOP

2 years ago

Would it be correct?

"dev": "tsx api/index.ts"

in prod, without passing the flag --env-file=.env will you understand how env's?

in the image as it is at the moment

Attachments


brody
EMPLOYEE

2 years ago

As previously mentioned, you need to add a start script and what you have just sent would be sufficient for the start script, you don't need to touch the dev script at all in your package.json

Once you have a start script, remove your custom start command from your Railway service.

in prod, without passing the flag --env-file=.env will you understand how env's?

You would set all your environmental variables in the service variables tab for your service, those then become available in the environment.


lucasgomesoficial
HOBBYOP

2 years ago

I did it this way:

"scripts": {
"dev": "tsx watch --env-file=.env api/index.ts",
"start": "tsx api/index.ts"
},

and changed the Custom Start Command to:
npm run start

I tried without too

and it still doesn't work


lucasgomesoficial
HOBBYOP

2 years ago

/app/api/prisma/index.ts:1

import { PrismaClient } from "@prisma/client";

^

SyntaxError: The requested module '@prisma/client' does not provide an export named 'PrismaClient'

at ModuleJob.instantiate (node:internal/modules/esm/modulejob:124:21)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

Node.js v18.18.2

now it is giving this error and it is crashing

WTF


brody
EMPLOYEE

2 years ago

What version of node do you use locally?


lucasgomesoficial
HOBBYOP

2 years ago

v20.9.0


brody
EMPLOYEE

2 years ago

In your package.json set engines.node to 20


lucasgomesoficial
HOBBYOP

2 years ago

I set the node version

"engines": {
"node": "20.9.0"
},
"scripts": {
"dev": "tsx watch --env-file=.env api/index.ts",
"build": "tsup api --format esm",
"start": "node dist/index.js"
},

I added the tsup library to transpile to JS

even did the deploy, but it just crashed


brody
EMPLOYEE

2 years ago

Please attach your deployment logs -

https://bookmarklets.up.railway.app/log-downloader/


lucasgomesoficial
HOBBYOP

2 years ago

Dude, I managed to do it, after these changes, all I had to do was go through the custom build command npx prisma generate, which I hadn't done before.

Thank you very much for your attention, all the best to you

Attachments


Loading...