8 months ago
I'm pretty new to all of this. I've tried for hours to find a solution. I really need help please.
```
node:internal/modules/cjs/loader:1143
throw err;
at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
code: 'MODULENOTFOUND',
}
Node.js v18.20.5
node:internal/modules/cjs/loader:1143
throw err;
^
Error: Cannot find module '/app/mysqld'
at Module.resolveFilename (node:internal/modules/cjs/loader:1140:15) at Module.load (node:internal/modules/cjs/loader:981:27)
at Function.executeUserEntryPoint as runMain
at node:internal/main/runmainmodule:28:49 {
code: 'MODULENOTFOUND',
requireStack: []
}
Node.js v18.20.5
Deploy crashed
``
0 Replies
8 months ago
why do you have a mysql daemon in your NodeJS application?
If you're trying to use a MySQL database then you can just deploy one into your Railway project
I created a new project using my github repo (a5886754-0e45-4ccd-83df-a4b57ca5ecaa).
I added MySQL service. I try to copy the variables in my .env. Idk why the HOST is railway.internal instead of something that finishes with .railway.app
i already have a local database called "maville" that i'm trying to deploy
8 months ago
Please don't ping conductors
8 months ago
You are not. Can you please explain what you're trying to do? Are you trying to copy your service env variables into your local environment? If so, do not use the internal URL, you will need to use your database's public URL
I created a database and i read that i could use railway to deploy it and make it public. I thought i had to add my add my github repository and then add MySQL
8 months ago
You can, that's exactly what you have to do. Folow what Fragly said above, add a database to your project then copy the environment variables into your app
8 months ago
Make sure to reference the environment variables rather than commit the secrets to Github
is my .env correct?
MYSQLHOST=localhost MYSQLUSER=root
MYSQLPASSWORD= MYSQLDATABASE=maville
MYSQL_PORT=3306
PORT=8080
8 months ago
Looks fine to me, but only you can see your env variables
8 months ago
If they match, that's good
8 months ago
Actually, MYSQL_PORT should be the public URL port on your database. Make sure those match
8 months ago
8 months ago
Example from one of my services
8 months ago
Your public networking URL should be used locally, internal URL should be used internally
still doesn't work idk what i'm doing wrong. I copied the env variables from railway and added them in my .env. I get this :
pattyboi22@MacBookAir MaVilleAPI % node index.js
Serveur API démarré sur http://localhost:8080
Erreur de connexion à la base de données : Error: getaddrinfo ENOTFOUND mysql.railway.internal
at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'mysql.railway.internal',
fatal: true
}
it works now i had to change the host to the public network one . The problem is i can't find my API public url
8 months ago
Your api won’t have one by default, you’ll have to generate one in the service settings
8 months ago
give this a read: https://docs.railway.com/quick-start
8 months ago
!s
Status changed to Solved adam • 8 months ago