nextjs-edgedb-auth-template icon indicating copy to clipboard operation
nextjs-edgedb-auth-template copied to clipboard

Deploying the fresh repo to Vercel fails to compile

Open monsieurpigeon opened this issue 1 year ago • 2 comments

I received this error when deploying the fresh repo to vercel.

Failed to compile.
--
17:31:01.972 |  
17:31:01.972 | ./app/dashboard/page.tsx:35:14
17:31:01.973 | Type error: Type '{ name: string; id: string; created: Date \| null; updated: Date \| null; created_by: { name: string; email: string \| null; }; }[]' is not assignable to type '(Omit<Item, "created_by"> & { created_by: { name: string; email: string; }; })[]'.
17:31:01.973 | Type '{ name: string; id: string; created: Date \| null; updated: Date \| null; created_by: { name: string; email: string \| null; }; }' is not assignable to type 'Omit<Item, "created_by"> & { created_by: { name: string; email: string; }; }'.
17:31:01.973 | Type '{ name: string; id: string; created: Date \| null; updated: Date \| null; created_by: { name: string; email: string \| null; }; }' is not assignable to type '{ created_by: { name: string; email: string; }; }'.
17:31:01.974 | The types of 'created_by.email' are incompatible between these types.
17:31:01.974 | Type 'string \| null' is not assignable to type 'string'.
17:31:01.974 | Type 'null' is not assignable to type 'string'.
17:31:01.974 |  
17:31:01.975 | 33 \|         </Link>
17:31:01.975 | 34 \|       </header>
17:31:01.975 | > 35 \|       <Items items={items} />
17:31:01.975 | \|              ^
17:31:01.975 | 36 \|     </>
17:31:01.975 | 37 \|   );
17:31:01.976 | 38 \| }
17:31:02.020 | ELIFECYCLE  Command failed with exit code 1.
17:31:02.043 | Error: Command "pnpm run build" exited with 1

I fixed it using this next.config update

const nextConfig = {
  typescript: {
    ignoreBuildErrors: true,
  },
  eslint: {
    ignoreDuringBuilds: true,
  },
};

I could have just fixed the type ... but when I do I get :

./dbschema/edgeql-js/funcops.ts:345:8
Type error: Type 'Set<any>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.

  343 |   }
  344 |   const descendants: string[] = [
> 345 |     ...new Set(
      |        ^
  346 |       [...typeSpec.values()]
  347 |         .filter(
  348 |           (type) =>

And i keep getting the same error if I update compilerOptions.target to es2015

I updated the build script to pnpm run prebuild; next build and the prebuild to npx @edgedb/generate edgeql-js

I thought vercel would run the prebuild automatically but it doesn't Updating the next.config makes this issue not blocking in that case.

Let me know if you need some more informations or versions to understand my issue. I can't figure it out myself.

monsieurpigeon avatar Apr 29 '24 22:04 monsieurpigeon

Pushed a bunch of fixes for the type issues, should be good to re-enable TypeScript on build. The ESLint story seems a little stranger: The existing config is targetting the new ESLint flat config, but it's built around a transitionary version. But Next doesn't yet support even the normal v9 flat config yet. I'll try to figure out the best way to revert to the v8 config and we'll fix it back up to flat config once that's officially supported by Next.js

I'll leave this issue open for now while we work out the ESLint situation.

scotttrinh avatar Apr 30 '24 01:04 scotttrinh

I've updated the eslint config and pushed some fixes. Let me know if you still have this issue.

beerose avatar Apr 30 '24 11:04 beerose