Issue Deploying Express Project
nmufson
HOBBYOP

a year ago

Receiving a 403 error when trying to access my deployed project. Error messages below. I'm using ejs files so I don't have an index.html in my public file. Also, /app/public is not a directory in my project, but rather /public is a directory at the root of my project.

https://github.com/nmufson/members-only

2024/09/24 16:23:08 [notice] 1#1: start worker process 36

Sep 24 12:23:48

2024/09/24 16:23:44 [error] 7#7: *1 directory index of "/app/public/" is forbidden, client: 100.64.0.2, server: , request: "GET / HTTP/1.1", host: "members-only-production-c726.up.railway.app"

Sep 24 12:23:48

100.64.0.2 - - [24/Sep/2024:16:23:44 +0000] "GET / HTTP/1.1" 403 200 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"

Sep 24 12:24:09

2024/09/24 16:24:00 [error] 10#10: *2 directory index of "/app/public/" is forbidden, client: 100.64.0.3, server: , request: "GET / HTTP/1.1", host: "members-only-production-c726.up.railway.app"

Sep 24 12:24:09

100.64.0.3 - - [24/Sep/2024:16:24:00 +0000] "GET / HTTP/1.1" 403 200 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"

Sep 24 12:25:11

2024/09/24 16:25:00 [info] 10#10: *2 client 100.64.0.3 closed keepalive connection

Sep 24 12:28:39

2024/09/24 16:28:37 [error] 8#8: *3 directory index of "/app/public/" is forbidden, client: 100.64.0.4, server: , request: "GET / HTTP/1.1", host: "members-only-production-c726.up.railway.app"

Sep 24 12:28:39

100.64.0.4 - - [24/Sep/2024:16:28:37 +0000] "GET / HTTP/1.1" 403 200 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"

Sep 24 12:29:41

2024/09/24 16:29:37 [info] 8#8: *3 client 100.64.0.4 closed keepalive connection

Sep 24 12:48:49

2024/09/24 16:48:48 [error] 9#9: *4 directory index of "/app/public/" is forbidden, client: 100.64.0.5, server: , request: "GET / HTTP/1.1", host: "members-only-production-c726.up.railway.app"

Sep 24 12:48:49

100.64.0.5 - - [24/Sep/2024:16:48:48 +0000] "GET / HTTP/1.1" 403 200 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"

Solved

5 Replies

brody
EMPLOYEE

a year ago

Nixpacks thinks this is a plain html, js, css page.

It is not detecting node because you do not have a package.json and package-lock.json file.

Add them.


nmufson
HOBBYOP

a year ago

Nixpacks thinks this is a plain html, js, css page.

It is not detecting node because you do not have a package.json and package-lock.json file.

Add them.

Thank you very much Brody. I have added the files.

I'm now having an issue with the psql db. it seems like there's an issue with the PGHOST variable. I have all my environment variables in railway set to match what railway gave me, including postgres.railway.internal for PGHOST.

Can you help me with this issue? Thank you!


brody
EMPLOYEE

a year ago

Looks like you may have some kind of postinstall script that is trying to access the database.

You can't access the database privately during the build, move whatever the postinstall script does to the start command so it can be done at runtime before starting your app.


nmufson
HOBBYOP

a year ago

All sorted now, thank you Brody!


brody
EMPLOYEE

a year ago

No problem!


Status changed to Solved brody over 1 year ago


Loading...