Deployment Help :.)

lucasgomesoficial
HOBBY

a year 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

a year ago

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


lucasgomesoficial
HOBBY

a year ago

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


a year ago

That page is absolutely not nothing?

Please read this docs page -

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


lucasgomesoficial
HOBBY

a year ago

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

Attachments


a year ago

Are you committing your .env file to GitHub?


lucasgomesoficial
HOBBY

a year ago


a year ago

Please attach your deployment logs -

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


lucasgomesoficial
HOBBY

a year ago

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


a year ago

Please follow the 3 steps.


lucasgomesoficial
HOBBY

a year 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


a year 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
HOBBY

a year 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


a year 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
HOBBY

a year 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
HOBBY

a year 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


a year ago

What version of node do you use locally?


lucasgomesoficial
HOBBY

a year ago

v20.9.0


a year ago

In your package.json set engines.node to 20


lucasgomesoficial
HOBBY

a year 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


a year ago

Please attach your deployment logs -

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


lucasgomesoficial
HOBBY

a year 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


Deployment Help :.) - Railway Help Station