question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not build project with V2 Typing. Next js build shows "Parsing error: Invalid character" with database.types.ts file.

See original GitHub issue

Was experimenting old project with Supabase-V2 Typing. Unfortunately stuck with Error in database.ts file which is database types generated by CLI tool.

Here is the error produced

./lib/database.ts
Error: Parsing error: Invalid character.

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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
CreatorX64commented, Nov 3, 2022

Btw this is my templorary fix (for anyone experiencing the same issue): Rather than deleting the whole eslint configuration file, I just added a .eslintignore file in my project and entered database.types.ts in it. Better than no configuration I guess 😄

1reaction
CreatorX64commented, Nov 3, 2022

Sadly TS playground didn’t complain.

Tried to alter my eslint config in different ways, but even the base config that Next.js generates causes this error.

However, if I delete the eslint configuration file completely, the project builds without this error.

For reference, this is my current eslint config (which causes the build to fail):

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "project": "./tsconfig.json"
  },
  "plugins": ["@typescript-eslint"],
  "extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"],
  "rules": {
    "@typescript-eslint/consistent-type-imports": "warn",
    "@next/next/no-img-element": "off"
  }
}

And below are the variations of config options I tried (all failed with the same error):

Variation 1:

{
  "extends": "next"
}

Variation 2:

{
  "extends": "next/core-web-vitals"
}

Variation 3:

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "project": "./tsconfig.json"
  },
  "plugins": ["@typescript-eslint"],
  "extends": ["plugin:@typescript-eslint/recommended"],
  "rules": {
    "@typescript-eslint/consistent-type-imports": "warn"
  }
}

At this point this seems like an issue with eslint rather than the database.types.ts file that Supabase generates. Will post an update if I find out the reason for this error.

Thanks a lot for your help @soedirgo 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignoring TypeScript Errors - next.config.js
js fails your production build ( next build ) when TypeScript errors are present in your project. If you'd like Next.js to dangerously...
Read more >
Error: TSError: Unable to compile TypeScript - Stack Overflow
My Project is built on Angular4 with typescript, e2e testing with protractor & karma. Travis-ci has this error: [03:34:54] E/launcher - Error: ...
Read more >
Changelog - Cypress Documentation
Fixed an issue with Angular Component Testing where urls within SASS/SCSS files were not being correctly resolved which could result in incomplete styling....
Read more >
Invalid template errors - Azure Resource Manager
Describes how to resolve invalid template errors when deploying Bicep files or Azure Resource Manager templates (ARM templates).
Read more >
Errors – Vercel Docs
Definition: The requested Serverless Function from the application did not return a string as the body. Occurrence: This could happen if the Serverless...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found