I'm using a local instance of mongodb in dokploy. When I try to build or run the project, I get an error that mongoose couldn't connect to the db, but the ip of the db in the error is set to localhost even though the variable is setup correctly.
[18:09:59] ERROR: Error: cannot connect to MongoDB. Details: connect ECONNREFUSED ::1:27017, connect ECONNREFUSED 127.0.0.1:27017I've tried to see if it was a problem with IP address and using
docker1.homeworks and shows an error with that address, but If I use the correct address
dokploy.homeit goes back to localhost
This is because your local db isn’t available at build. Use experimental build mode compile:
https://payloadcms.com/docs/production/building-without-a-db-connection#using-the-experimental-build-mode-nextjs-build-flagIt bypasses Next’s database requirement for SSG
And what about running
pnpm devI'm getting the same behaivour
Are you trying to connect to your local Dokploy database from your local machine? As far I know, you need an external connection string to do that
I'm using the server ip on my local machine, it was working before I updated all packages
Does it work if you roll back your update?
I've tried downgrading all payloadcms package as lower as 3.59.0 but didn't work
I was trying to migrate to cloudflare workers, but since mongoose isn't supported yet, I rolledback all the changes, now I'm getting this problem
Have you tried an external connection string from Dokploy? Just to test?
I've tried connecting to the db using the same string I have setup as enviroment variable and it did work using IntelIJ DataGrip, so the URI works
It does build with this change
But if I do
pnpm startI get the db connection error
Fixed, I was really dumb, in the replica configuration the hosts was set to
127.0.0.1so it could be reached from outside. Change to the IP of the VM and not it's working back again 🤦
Star
Discord
online
Get dedicated engineering support directly from the Payload team.