Open stevekuznetsov opened 4 weeks ago
Hey! We couldn't reproduce your issue, I tried:
npx create-payload-app@beta -t website
using the postgres vercel adapter.npm i --force
(as you have package-lock.json
), pnpm dev
, clicked "seed" and it worked for me.Hey @stevekuznetsov & @r1tsuu!
I've also encountered this exact issue during a new project setup today.
Steps to Reproduce:
postgres://default:************@************:5432/verceldb?sslmode=require
.npx create-payload-app@beta -t website
.pnpm dev
.localhost:3000/admin
, created a new user, and logged in.[15:27:39] INFO: Seeding database...
[15:27:39] INFO: — Clearing media...
[15:27:39] INFO: — Clearing collections and globals...
[15:27:39] INFO: Revalidating header
[15:27:39] INFO: Revalidating footer
{ pages: { docs: [], errors: [] } }
[15:27:40] INFO: — Seeding demo author and user...
[15:27:41] INFO: — Seeding media...
[15:27:42] INFO: — Seeding categories...
[15:27:45] INFO: — Seeding posts...
[15:27:46] INFO: Revalidating post at path: /posts/digital-horizons
[15:27:46] INFO: Revalidating post at path: /posts/global-gaze
[15:27:47] INFO: Revalidating post at path: /posts/dollar-and-sense-the-financial-forecast
[15:27:48] ERROR: Error validating filter options for collection posts
err: {
"type": "NotFound",
"message": "Not Found",
"stack":
NotFound: Not Found
at findByIDOperation (webpack-internal:///(rsc)/./node_modules/payload/dist/collections/operations/findByID.js:71:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async populateAuthors (webpack-internal:///(rsc)/./src/collections/Posts/hooks/populateAuthors.ts:13:31)
at async eval (webpack-internal:///(rsc)/./node_modules/payload/dist/collections/operations/find.js:230:30)
at async eval (webpack-internal:///(rsc)/./node_modules/payload/dist/collections/operations/find.js:228:17)
at async Promise.all (index 1)
at async findOperation (webpack-internal:///(rsc)/./node_modules/payload/dist/collections/operations/find.js:226:19)
at async validateFilterOptions (webpack-internal:///(rsc)/./node_modules/payload/dist/fields/validations.js:404:36)
at async promise (webpack-internal:///(rsc)/./node_modules/payload/dist/fields/hooks/beforeChange/promise.js:84:38)
at async Promise.all (index 0)
at async traverseFields (webpack-internal:///(rsc)/./node_modules/payload/dist/fields/hooks/beforeChange/traverseFields.js:38:5)
at async promise (webpack-internal:///(rsc)/./node_modules/payload/dist/fields/hooks/beforeChange/promise.js:309:17)
at async Promise.all (index 1)
at async traverseFields (webpack-internal:///(rsc)/./node_modules/payload/dist/fields/hooks/beforeChange/traverseFields.js:38:5)
at async promise (webpack-internal:///(rsc)/./node_modules/payload/dist/fields/hooks/beforeChange/promise.js:333:17)
at async Promise.all (index 1)
at async traverseFields (webpack-internal:///(rsc)/./node_modules/payload/dist/fields/hooks/beforeChange/traverseFields.js:38:5)
at async beforeChange (webpack-internal:///(rsc)/./node_modules/payload/dist/fields/hooks/beforeChange/index.js:22:5)
at async updateByIDOperation (webpack-internal:///(rsc)/./node_modules/payload/dist/collections/operations/updateByID.js:253:22)
at async seed (webpack-internal:///(rsc)/./src/endpoints/seed/index.ts:225:5)
at async Object.seedHandler [as handler] (webpack-internal:///(rsc)/./src/endpoints/seedHandler.ts:22:9)
at async handleCustomEndpoints (webpack-internal:///(rsc)/./node_modules/@payloadcms/next/dist/routes/rest/index.js:198:19)
at async eval (webpack-internal:///(rsc)/./node_modules/@payloadcms/next/dist/routes/rest/index.js:420:36)
at async AppRouteRouteModule.do (/home/ben/projects/bato-web-app/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:10:32709)
at async AppRouteRouteModule.handle (/home/ben/projects/bato-web-app/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:10:38210)
at async doRender (/home/ben/projects/bato-web-app/node_modules/next/dist/server/base-server.js:1493:42)
at async responseGenerator (/home/ben/projects/bato-web-app/node_modules/next/dist/server/base-server.js:1834:28)
at async DevServer.renderToResponseWithComponentsImpl (/home/ben/projects/bato-web-app/node_modules/next/dist/server/base-server.js:1878:28)
at async DevServer.renderPageComponent (/home/ben/projects/bato-web-app/node_modules/next/dist/server/base-server.js:2292:24)
at async DevServer.renderToResponseImpl (/home/ben/projects/bato-web-app/node_modules/next/dist/server/base-server.js:2330:32)
at async DevServer.pipeImpl (/home/ben/projects/bato-web-app/node_modules/next/dist/server/base-server.js:984:25)
at async NextNodeServer.handleCatchallRenderRequest (/home/ben/projects/bato-web-app/node_modules/next/dist/server/next-server.js:281:17)
at async DevServer.handleRequestImpl (/home/ben/projects/bato-web-app/node_modules/next/dist/server/base-server.js:877:17)
at async /home/ben/projects/bato-web-app/node_modules/next/dist/server/dev/next-dev-server.js:373:20
at async Span.traceAsyncFn (/home/ben/projects/bato-web-app/node_modules/next/dist/trace/trace.js:157:20)
at async DevServer.handleRequest (/home/ben/projects/bato-web-app/node_modules/next/dist/server/dev/next-dev-server.js:370:24)
at async invokeRender (/home/ben/projects/bato-web-app/node_modules/next/dist/server/lib/router-server.js:183:21)
at async handleRequest (/home/ben/projects/bato-web-app/node_modules/next/dist/server/lib/router-server.js:360:24)
at async requestHandlerImpl (/home/ben/projects/bato-web-app/node_modules/next/dist/server/lib/router-server.js:384:13)
at async Server.requestListener (/home/ben/projects/bato-web-app/node_modules/next/dist/server/lib/start-server.js:142:13)
"data": null,
"isOperational": true,
"isPublic": false,
"status": 404,
"name": "NotFound"
}
GET /api/seed 500 in 9379ms
[15:27:48] ERROR: The following field is invalid: relatedPosts
Environment Info
Binaries:
Node: 20.10.0
npm: 10.2.3
Yarn: 1.22.22
pnpm: 9.4.0
Relevant Packages:
payload: 3.0.0-beta.123
next: 15.0.0
@payloadcms/email-nodemailer: 3.0.0-beta.123
@payloadcms/graphql: 3.0.0-beta.123
@payloadcms/live-preview: 3.0.0-beta.123
@payloadcms/live-preview-react: 3.0.0-beta.123
@payloadcms/next/utilities: 3.0.0-beta.123
@payloadcms/payload-cloud: 3.0.0-beta.123
@payloadcms/plugin-form-builder: 3.0.0-beta.123
@payloadcms/plugin-nested-docs: 3.0.0-beta.123
@payloadcms/plugin-redirects: 3.0.0-beta.123
@payloadcms/plugin-search: 3.0.0-beta.123
@payloadcms/plugin-seo: 3.0.0-beta.123
@payloadcms/richtext-lexical: 3.0.0-beta.123
@payloadcms/translations: 3.0.0-beta.123
@payloadcms/ui/shared: 3.0.0-beta.123
react: 19.0.0-rc-65a56d0e-20241020
react-dom: 19.0.0-rc-65a56d0e-20241020
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Fri Mar 29 23:14:13 UTC 2024
Available memory (MB): 7866
Available CPU cores: 12
Yeah sorry @r1tsuu I don't believe there were any other steps necessary to reproduce this.
I have had the same issue. It is erroring out at the following stage of the seeding function:
// update each post with related posts await payload.update({ id: post1Doc.id, collection: 'posts', data: { relatedPosts: [post2Doc.id, post3Doc.id], }, req, }) ...
I wonder if it is trying to update the related posts data for each post, before it has actually finished populating each post, so it is requesting post1Doc.id, and that doesn't yet exist?
When I comment out the three related post updates in the seed function it completes the seeding successfully.
I'm also having some slowness issues on even my localhost, so i wonder whether the vercel postgres connection is slow and that is causing the issues.
Describe the Bug
I created a brand-new app and connected to a Vercel-managed Postgres instance. I opened the admin panel and clicked the seed button. Seeding fails with this error while adding the related posts to the first post:
I've added loads of debugging information and I can fetch all of the posts, cycle through them and execute the meat of the
populateAuthors
logic - fetching the authors - with no issue whatsoever. As far as I can tell there is nothing in theposts
table after this script runs and fails.Link to the code that reproduces this issue
https://github.com/NWACus/website/commit/5a9b520f30b86b663f57cb0334c90930189402eb#diff-ec70d248db3563b095d5b75fc9c001d30a315e4b2e01e920277bb1c1261adfe5R238
Reproduction Steps
Which area(s) are affected? (Select all that apply)
area: templates
Environment Info