Search code examples
next.jsprismavercel

Is Vercel Caching causing issues?


For my project i'm using prisma/supabase with next js and then hosting on vercel. Any changes i make to my github automatically generates a new development deployment on vercel. Even though my project is working fine locally, my recent generation resulted in an error which i can only think has something to do with vercels cache.

Half way through the project i added a new field 'slug' to my schema and populated my existing tables with said slug. I then used the slug when generating getStaticProps.

Everything works fine locally but when i generate a new deployment on vercel i get the following error :

Error: Unknown arg `slug` in where.comp.slug for type CompRelationFilter. Did you mean `is`?
Unknown field `slug` for select statement on model Comp. Did you mean `cID`?
    at Object.validate (/vercel/path0/node_modules/@prisma/client/runtime/index.js:34758:20)
    at PrismaClient._executeRequest (/vercel/path0/node_modules/@prisma/client/runtime/index.js:39752:17)
    at consumer (/vercel/path0/node_modules/@prisma/client/runtime/index.js:39693:23)
    at /vercel/path0/node_modules/@prisma/client/runtime/index.js:39697:49
    at AsyncResource.runInAsyncScope (async_hooks.js:197:9)
    at PrismaClient._request (/vercel/path0/node_modules/@prisma/client/runtime/index.js:39697:27)
    at request (/vercel/path0/node_modules/@prisma/client/runtime/index.js:39802:77)
    at _callback (/vercel/path0/node_modules/@prisma/client/runtime/index.js:40010:14)
    at PrismaPromise.then (/vercel/path0/node_modules/@prisma/client/runtime/index.js:40017:23)

I created a new migration, synced it to my database, comfirmed its there on both prisma studio and database directly. So my only guess is it has something to do with vercel's cache, have they cached my database somewhere or something in node modules thats attributing to this error?

This is my retrieval code that works perfectly for other pages:

const data = await prisma.event.findMany({
    where: {
        sTime: {
        gte: numericToDate(numericDate(today), [0,0]), //provided date from 0 hours
      },
      comp: {
        slug: compPre
    }},
        orderBy: {
          sTime: 'asc',
        },
      include: {
      Eventor: {
        select: {
          title: true,
          type:true,
          eID: true,
          imgUrl: true
        }, // Return all fields
    },
    ch: {
      select: {
        title: true,
        chID: true,
        imgUrl: true
      }, // Return all fields
  },
  sport: {
    select: {
      title: true,
      sID: true
    }, // Return all fields
  },
  comp: {
    select: {
      title: true,
      slug: true,
      cID: true,
      imgUrl:true
    }, // Return all fields
  }},
  
      
  })

Thanks for any help


Solution

  • Fixed it by including:

    "vercel-build": "prisma generate && prisma migrate deploy && next build",
    

    in scripts in package.json