Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PayloadCMS: type "serial" does not exist #1465

Closed
j-mcgregor opened this issue Apr 30, 2024 · 3 comments
Closed

PayloadCMS: type "serial" does not exist #1465

j-mcgregor opened this issue Apr 30, 2024 · 3 comments
Labels
bug Something isn't working needs-triage

Comments

@j-mcgregor
Copy link

Describe the bug

First off, love Xata! We want to adapt it into our full code base and it works for everything except for PayloadCMS. I've left comments on relevant PayloadCMS issues.

After creating a new Postgres-enabled database and storing the DATABASE_URI with fresh API key, I try and spin up a new payload (beta) app. 2 things then happen:

  • Error 1: Resolved by allowing Xata to make the necessary table changes by following the Xata UI
 ⨯ Internal error: error: unknown statement [<nil>] on regular level, see https://xata.io/sql-support for the support matrix
    at /root/node_modules/pg-pool/index.js:45:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async DrizzleORMPgClient.query (/root/node_modules/drizzle-kit/payload.js:34498:21)
    at async apply (/root/node_modules/drizzle-kit/payload.js:36648:9)
    at async pushDevSchema (../../node_modules/@payloadcms/db-postgres/dist/utilities/pushDevSchema.js:47:5)
    at async Object.connect (../../node_modules/@payloadcms/db-postgres/dist/connect.js:84:5)
    at async BasePayload.init (../../node_modules/payload/dist/index.js:215:13)
  • Error 2: Unresolved
 ⨯ Internal error: error: type "serial" does not exist
    at /root/node_modules/pg-pool/index.js:45:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async DrizzleORMPgClient.query (/root/node_modules/drizzle-kit/payload.js:34498:21)
    at async apply (/root/node_modules/drizzle-kit/payload.js:36648:9)
    at async pushDevSchema (../../node_modules/@payloadcms/db-postgres/dist/utilities/pushDevSchema.js:47:5)
    at async Object.connect (../../node_modules/@payloadcms/db-postgres/dist/connect.js:84:5)
    at async BasePayload.init (../../node_modules/payload/dist/index.js:215:13)

I'm guessing its a version / pg flavour mismatch but I don't know

To Reproduce

  1. Create a postgres-enabled Xata database and copy the API key-populated Database URI
  2. Install beta Payload app: npx create-payload-app@beta and paste the URI into the terminal when prompted
  3. Run the app
  4. In the Xata UI, you should see an option pop up (in the schema panel or individual tables) to allow Xata to make the necessary changes
  5. Bug 2 should appear in the terminal

Expected behavior

I should be able to use Xata Postgres for my PayloadCMS database

Software version

// package json
"dependencies": {
    "@payloadcms/db-postgres": "beta",
    "@payloadcms/next": "beta",
    "@payloadcms/plugin-cloud": "beta",
    "@payloadcms/richtext-lexical": "beta",
    "cross-env": "^7.0.3",
    "next": "^14.3.0-canary.7",
    "payload": "beta",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "sharp": "0.32.6"
  },
  "devDependencies": {
    "@types/node": "^20.11.25",
    "@types/react": "^18.2.64",
    "@types/react-dom": "^18.2.21",
    "dotenv": "^16.4.5",
    "tsx": "^4.7.1",
    "typescript": "^5.4.2"
  },

Additional context

I'm following up enquiries with Payload too. Since both Xata and Payload features right now are in beta, I know its a longshot but you lot seem like wizards so thought I'd ask

@j-mcgregor j-mcgregor added the bug Something isn't working label Apr 30, 2024
@karranx
Copy link

karranx commented Jul 29, 2024

I am not using xata yet getting the "serial does not exist error" so maybe its something with payload itself. Did you find a fix?

@SferaDev
Copy link
Member

SferaDev commented Jul 29, 2024

I'm going to close this issue as it's fixed, thanks for the bump.

PayloadCMS uses drizzle behind the scenes for Postgres connection, we worked with Drizzle and they fixed the problem with serial types in their codebase.

@karranx Are you using Drizzle by any chance, wave you updated to a recent version?

@karranx
Copy link

karranx commented Jul 29, 2024

@SferaDev i am using payload. the issue was on my end. i had conflicting table names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

3 participants