Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker build failed with Type Error #58

Open
2 tasks done
jainvaibhav671 opened this issue Jun 9, 2023 · 1 comment
Open
2 tasks done

Docker build failed with Type Error #58

jainvaibhav671 opened this issue Jun 9, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@jainvaibhav671
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

It is a Typescript syntax error with isolatedModules on

To Reproduce

I was building a docker image for my application using this template on NextJS docs

Building a NextJS app with supabase should raise this error
This is my code My Code.

Expected behavior

Expected it to build when the Dockerfile ran next build

Screenshots

This is the error I got from docker build
https://drive.google.com/file/d/1HRU_2bOrK5zQPGKvxAIPZ52_TPAv9NO9/view?usp=sharing

System information

  • OS: Linux 18.04
  • Version of supabase-js: ^2.24.0
  • Version of Node.js: 18.16.0

Additional context

I am using NextJS with TypeScript+SWC.
I tried setting isolatedModules to false, but when I ran npm run build it set it back to true

@jainvaibhav671 jainvaibhav671 added the bug Something isn't working label Jun 9, 2023
@Gwened
Copy link

Gwened commented Apr 17, 2024

I also have this error when I try to build my Next.js app:

./node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@supabase/supabase-js/src/index.ts:17:3
Type error: Re-exporting a type when 'isolatedModules' is enabled requires using 'export type'.

  15 |   FunctionsRelayError,
  16 |   FunctionsError,
> 17 |   FunctionInvokeOptions,
     |   ^
  18 |   FunctionRegion,
  19 | } from '@supabase/functions-js'
  20 | export * from '@supabase/realtime-js'

FunctionInvokeOptions is exported both in functions-js and supabase-js (note: I don't use functions-js directly).

Setting isolatedModules to false isn't possible at the moment, because next build forces it to true:

   We detected TypeScript in your project and reconfigured your tsconfig.json file for you. Strict-mode is set to false by default.
   The following mandatory changes were made to your tsconfig.json:

        - isolatedModules was set to true (requirement for SWC / Babel)

(see also Next.js issue)

For now, the workaround is to add this in next.config:

typescript: {
    // !! WARN !!
    // Dangerously allow production builds to successfully complete even if
    // your project has type errors.
    // This is to workaround the supabase-js error, see isolatedModule in tsconfig.json
    // !! WARN !!
    ignoreBuildErrors: true,
  },

Could you merge jainvaibhav671's PR to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants