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
2 years ago
Please provide more details as "does not work" unfortunately doesn't give enough information.
2 years ago
the return should be {ping: pong}, but nothing
Attachments
2 years ago
This service has other routes, I created this simple get, just for testing.
I already checked this and nothing
Attachments
2 years ago
No, but I configured the env here.
https://github.com/lucasgomesoficial/atividade2-FullSttacking/tree/master/server
2 years ago
I don't understand, I don't know this tool, add it to the browser's fav, what now?
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
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.
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
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.
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
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
2 years ago
v20.9.0
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
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