reactjsnext.jssupabase

Next Js with Supabase Failed to compile


I created a project with Next.js and Supabase, and everything was running smoothly. However, after adding a table and generating TypeScript Definitions from the PostgreSQL schema using Supabase CLI, I encountered an issue when running the "npm run build" command with the following error message:

./src/lib/database.types.ts
Error: Parsing error: File appears to be binary.

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules

Do you have any suggestions or steps I can take to address this issue? I appreciate your help.

I have tried with this command: npx supabase gen types typescript --project-id my-project-id > src/lib/database.types.ts


Solution

  • I fixed this issue by adding the file to my .eslintignore file. In my case it is located in lib/database.types.ts

    This tells eslint to ignore the file during validation.

    I'm not sure if the Supabase CLI generates it incorrectly, but generated files can be an issue for eslint validation.