payload icon indicating copy to clipboard operation
payload copied to clipboard

postgres vercel column "prefix" does not exist

Open Eric-Arz opened this issue 1 year ago • 4 comments

Link to reproduction

No response

Describe the Bug

Hi,

we are having trouble when uploading files in production on Vercel because we always get this error:

error: column "prefix" does not exist at /var/task/node_modules/pg/lib/client.js:526:17 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async /var/task/node_modules/drizzle-orm/node-postgres/index.cjs:41:28 at async find (/var/task/node_modules/@payloadcms/db-postgres/dist/find/findMany.js:167:21) at async Object.findOne (/var/task/node_modules/@payloadcms/db-postgres/dist/findOne.js:20:22) at async docWithFilenameExists (/var/task/.next/server/chunks/3005.js:28:239681) at async getSafeFileName (/var/task/.next/server/chunks/3005.js:28:248633) at async generateFileData (/var/task/.next/server/chunks/3005.js:28:242926) at async create (/var/task/.next/server/chunks/3005.js:28:47026) at async handler (/var/task/.next/server/chunks/2537.js:1:1921) { length: 106, severity: 'ERROR', code: '42703', detail: undefined, hint: undefined, position: '21', internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'parse_relation.c', line: '3713', routine: 'errorMissingColumn' }

our media collection does indeed not have a prefix, so we don't understand why payload keeps trying to use it. Fully resetting our migration history and making a single clean new one didn't resolve the issue either. We can't use the latest version of db-postgres because of https://github.com/payloadcms/payload/issues/5589

Regards,

Eric

To Reproduce

setup a payload project with next-payload and db-postgres on vercel and try uploading a file

Payload Version

2.12.1

Adapters and Plugins

@payloadcms/db-postgres: 0.3.1

Eric-Arz avatar Apr 11 '24 13:04 Eric-Arz

I've been experiencing a similiar issue. My guess is that it's a problem with Drizzle and custom schema names. Are you also using schemaName in the Payload config?

maneike avatar Apr 12 '24 12:04 maneike

@Eric-Arz, I am also curious about maneike's question. Are you using a cusotm schema name?

I'm curious if adding a drizzle.config.ts with schema and schemaFilter would fix this or your issue @maneikie?

https://orm.drizzle.team/kit-docs/config-reference#schemafilter

Let me know. I'm labeling this as a dependency issue for now, but we'll keep it open until we know more.

Last note, we're only going to fix this if it is an issue with payload v3, which is currently in beta. We're not addressing anything else related to next-payload.

DanRibbens avatar Apr 15 '24 18:04 DanRibbens

@DanRibbens Thanks for digging in!

Even with such drizzle.config.ts, the issue persists:

import type { Config } from "drizzle-kit";

export default {
  schemaFilter: ["payload"],
  schema: ["payload"],
} satisfies Config;

maneike avatar Apr 15 '24 19:04 maneike

@maneike no we are not using schemaName

Eric-Arz avatar Apr 16 '24 09:04 Eric-Arz