Postgres infinite pulling schema from database
Link to reproduction
No response
Environment Info
Binaries:
Node: 20.12.1
npm: 10.5.0
Yarn: N/A
pnpm: 8.14.2
Relevant Packages:
payload: 3.0.0-beta.96
next: 15.0.0-canary.104
@payloadcms/email-nodemailer: 3.0.0-beta.96
@payloadcms/graphql: 3.0.0-beta.96
@payloadcms/next/utilities: 3.0.0-beta.96
@payloadcms/plugin-cloud: 3.0.0-beta.96
@payloadcms/richtext-lexical: 3.0.0-beta.96
@payloadcms/translations: 3.0.0-beta.96
@payloadcms/ui/shared: 3.0.0-beta.96
react: 19.0.0-rc-06d0b89e-20240801
react-dom: 19.0.0-rc-06d0b89e-20240801
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:32:11 PDT 2023; root:xnu-10002.41.9~7/RELEASE_ARM64_T6030
Available memory (MB): 36864
Available CPU cores: 12
Describe the Bug
Stuck on pulling schema from database when setting up a blank project.
⨯ ErrorEvent {
digest: '3527995339',
[Symbol(kTarget)]: WebSocket {
_events: [Object: null prototype] {
error: [Function],
message: [Function],
close: [Function],
open: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
_binaryType: 'arraybuffer',
_closeCode: 1006,
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: <Buffer >,
_closeTimer: null,
_errorEmitted: true,
_extensions: {},
_paused: false,
_protocol: '',
_readyState: 3,
_receiver: null,
_sender: null,
_socket: null,
_bufferedAmount: 0,
_isServer: false,
_redirects: 0,
_autoPong: true,
_url: 'wss://localhost/v2',
_req: null,
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
[Symbol(kType)]: 'error',
[Symbol(kError)]: AggregateError [ECONNREFUSED]:
at internalConnectMultiple (node:net:1116:18)
at afterConnectMultiple (node:net:1683:7)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
code: 'ECONNREFUSED',
[errors]: [ [Error], [Error] ]
},
[Symbol(kMessage)]: ''
}
Pulling schema from database. . .
Reproduction Steps
-> pnpm create-payload-app@beta -> Choose blank project -> Enter postgres database uri -> pnpm i pg
- see why pg install is necessary here: https://github.com/payloadcms/payload/issues/7974#issuecomment-2324429255
-> pnpm dev -> Navigate to /admin page
Adapters and Plugins
db-postgres
I run into this all the time. Once it starts behaving like this I usually have to:
- shutdown payload in dev mode
- clear Next.js cache
- close all open tabs that were being hot reloaded (this seems to be the main thing)
- start payload again in dev mode
just found something interesting:
- I created a website project using
npx create-payload-app@beta - chose the vercel postgres
- added URI from vercel for the db connection
- installed
pgpackage byyarn add pg - stucked trying to pull schema
then:
- found that adapter looking for a
process.env.POSTGRES_URLinsrc/payload.config.ts - but payload defines
DATABASE_URIto keep the database connection string in.env - I just replaced
process.env.POSTGRES_URLwithprocess.env.DATABASE_URIinsrc/payload.config.ts - it works!
Hey! The issue above was fixed here https://github.com/payloadcms/payload/pull/8743 and we also now ship @payloadcms/db-postgres-vercel with the pg dependency so it should be resolved.
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.