Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Cannot read properties of undefined (reading 'createdAt')

default discord avatar
vpjmlast year

Hi, does anyone know why I'm getting the following error after replacing

payload.find

with

SELECT * FROM A WHERE C LIMIT 1

and import sql from drizzle :

node_modules\@payloadcms\db-postgres\src\schema\createIndex.ts:22
      columns = [table[name]]
                      ^
TypeError: Cannot read properties of undefined (reading 'createdAt') at func (node_modules\@payloadcms\db-postgres\src\schema\createIndex.ts:22:23)

Even after commenting out the additions that caused the error, I can't rerun my code again



VERSION : V2 , DB : POSTGRES



The only tables that don't have a

created_at

column are the

${tableName}_rels

tables


UPDATE : i add create_at column for each

rels table nothing change

UPDATE : I removed every table in my postgres database, commented out all my plugins, restarted the server, and the issue persists. Payload refuses to push the schema except for ``payload

${...}

tables UPDATE : I only keep one simple table (User) in payload config, still in error state ```const User: CollectionConfig = { slug: 'user', labels: { singular: 'User', plural: 'Users' }, auth: true, admin: { useAsTitle: 'email', }, fields: [], }``` This table is the one triggering the error in PayloadCMS https://github.com/payloadcms/payload/blob/eca1517237c78983c192f4bafa92a86d94a0de9e/packages/db-postgres/src/schema/createIndex.ts#L22 SUMMARY : I removed all the tables from the collections attribute in the config (including user table) and every plugin from plugin attribute, but the error persists with user table. I am going to delete my node_modules and then reinstall it <:painwithcoffee:1116349314076254300> Nothing change after re-install To use

sql

, I installed

drizzle-orm

, but having

drizzle-orm

installed caused this issue. So, I need to uninstall it and reinstall

@payloadcms/db-postgres``

    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team.