`rW_DataMigration` table failure on deploy? [SOLVED]

Hi all,
Not exactly sure what I’ve done wrong, but I’ve broken the something in the deploy pipeline and am unable to publish our app.

I’ve narrowed it down to the yarn rw data-migrate up command which returns the below error (thrown in the rw package’s cli code).

It’s happening both locally, and in vercel.

At first glance it looks like it might be a type generation issue with the db, but, yarn rw g types runs without a hitch?

The rW_DataMigration table (or at the very least its type) isn’t being consumed?

Anyone have any ideas as to what I might have done wrong, and how to trace it back?

TypeError: Cannot read properties of undefined (reading 'findMany')
    at getPendingDataMigrations (/home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/cli-data-migrate/dist/commands/upHandler.js:154:55)
    at handler (/home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/cli-data-migrate/dist/commands/upHandler.js:72:39)
    at Object.handler (/home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/cli-data-migrate/dist/commands/up.js:61:9)
    at runYargs (/home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/cli/dist/index.js:187:3)
    at /home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/cli/dist/index.js:138:7
    at main (/home/devlinux/devlinux/monsteraa/node_modules/@redwoodjs/cli/dist/index.js:119:3)

so at this line:

const ranDataMigrations = await db.rW_DataMigration.findMany(
    {
      orderBy: { version: "asc" }
    }
  );

Ok so, I worked it out.
I’ve reviewed the commits to our App’s repo when the error began to occur.
The @redwoodjs/cli-data-migrate package has only recently been added.

So, a colleague had run this (yarn redwood dataMigrate install)in an effort to debug an unrelated error.

To undo it, that also took some working out. you have to:

  • yarn remove @redwoodjs/cli-data-migrate; and
  • delete the dataMigrations dir

Hey Tony,

It feels like you are satisfied with your answer.

Curious, why did installing dataMigrate cause a problem? I ask from the perspective of: when I just install something, I don’t expect it to break. I would expect for it to be set up and ready to work for me.

I have never run a dataMigration, so I am left wondering this.

Thanks for checking in Barrett.

It was covered by the docs ie, the issue was that the changes to prisma.schema weren’t committed and prisma migrate dev wasn’t run. So, the rW_DataMigration table called in the getPendingDataMigrations function wasn’t in the prisma client.

So, it was actrually only a partial install due to user error.

I suppose the errors could have been more verbose, but I don’t suspect the error will crop up with any frequency if users follow docs.

On a side note, I know the package docs say it’s there for “mainly for docker”, but what exactly for, I’m not sure.

1 Like

Speaking of…

1 Like