Next.js + Magic SDK V6 + OAuth Extension Fails with `TypeError: class constructors must be invoked with 'new'`
See original GitHub issue✅ Prerequisites
- Did you perform a cursory search of open issues? Is this bug already reported elsewhere?
- Are you running the latest SDK version?
- Are you reporting to the correct repository (
magic-sdk
)?
🐛 Description
When initializing the client with:
export const createClientMagicInstance = () => {
if (typeof window === 'undefined') {
throw Error('Creating magic instance without browser window');
}
return new Magic(magicPublicKey, {
extensions: [new OAuthExtension()],
});
within Next.js, the following error is thrown class constructors must be invoked with 'new'
.
This only happens when calling new OAuthExtension()
. The issue is gone when downgrading to "magic-sdk": "^5.1.0"
🌎 Environment
Software | Version(s) |
---|---|
magic-sdk |
6.0.5 |
@magic-ext/oauth |
0.9.0 |
next |
11.1.2 |
Browser | Firefox |
yarn |
16.7 |
Operating System | MacOS |
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Next 12 Runtime TypeError: Class constructors cannot be ...
The application should run / build successfully as it did in Next 11. To Reproduce. Install next 12 / typescript: npx create-next-app@latest -- ......
Read more >ThreeJS + NextJS: class constructors must be invoked with 'new'
I am trying to render a simple scene inside a nextJS route inside "lab2". I keep recieving this error: class constructors must be...
Read more >Magic Link Authentication and Route Controls with Supabase ...
In this video, we'll build out a Next. js app that enables navigation, authentication, authorization, redirects (client and server-side), ...
Read more >Next.js Authentication with Magic.link Tutorial - YouTube
I go through setup and explain the code line by line for setting up Magic.link with Next. js to authenticate users and how...
Read more >Passwordless Authentication with Next.js, Prisma, and next-auth
In this post, you'll learn how to add passwordless authentication to your Next.js app using Prisma and next-auth.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ideopunk
6.x
was all about better ES module compatibility, no API changes. You can use5.x
in the meanwhile!This issue has been resolved in
magic-sdk@6.0.7
and@magic-sdk/oauth@0.9.2
, as well as for these other extensions:@magic-ext/react-native-oauth
@magic-ext/webauthn
Our Web3-related extensions will follow suit.