#TypeError: migration.up is not a function on production (docker)

2 messages · Page 1 of 1 (latest)

neon gulch
#

Payload: 2.11.1
My migration is running in dev setup. When I try to run it in the production docker container I get the error migration.up is not a function.

The command which I use inside the docker container:
yarn payload:production migrate
while payload:production is defined in the package.json as

cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production payload

The error msg

INFO (payload): Migrating: 20240220_170408_initial_db_seeds
ERROR (payload): Error running migration 20240220_170408_initial_db_seeds
    err: {
      "type": "TypeError",
      "message": "migration.up is not a function",
      "stack":
          TypeError: migration.up is not a function
              at Object.migrate (/app/node_modules/payload/dist/database/migrations/migrate.js:43:29)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async migrate (/app/node_modules/payload/dist/bin/migrate.js:64:13)
    }
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

TypeError: migration.up is not a function
    at Object.migrate (/app/node_modules/payload/dist/database/migrations/migrate.js:43:29)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async migrate (/app/node_modules/payload/dist/bin/migrate.js:64:13)

Node.js v20.11.1
error Command failed with exit code 1.

The migration file

import { MigrateUpArgs, MigrateDownArgs } from "@payloadcms/db-mongodb";
import { seedMarkets } from "../seed/initMarkets";
...

export async function up({ payload }: MigrateUpArgs): Promise<void> {
  await seedMarkets(payload);
  ...
}

export async function down({ payload }: MigrateDownArgs): Promise<void> {
  // Migration code
}

All seed files are in the right spot inside the docker container.
Any idea where to start looking into?

pastel pierBOT