Next.js 15 ReferenceError: Cannot access 'isBrowser' before initialization #1020
-
In the clean project Next 15 made a form: import { createClient } from "@deepgram/sdk"; async function handleUpload(dataForm: FormData) { return ( Load Audio Submit ); } When calling a function createClient the browser displays an error: How can I fix this error? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
Hey there! It looks like you haven't connected your GitHub account to your Deepgram account. You can do this at https://community.deepgram.com - being verified through this process will allow our team to help you in a much more streamlined fashion. |
Beta Was this translation helpful? Give feedback.
-
It looks like we're missing some important information to help debug your issue. Would you mind providing us with the following details in a reply?
|
Beta Was this translation helpful? Give feedback.
-
It seems like you're encountering a scope issue with the 'isBrowser' variable in your Next.js project. This error typically occurs when a variable is used before it's defined or initialized. However, without seeing the full context of your code, it's hard to provide a precise solution. The 'isBrowser' variable might be used in the '!subteam^S01J8LPFU8N|@deepgram/sdk' package or in your own code. If 'isBrowser' is a variable in your own code, make sure it's defined before you call the createClient function. If it's in the '!subteam^S01J8LPFU8N|@deepgram/sdk' package, it might be a bug or compatibility issue with Next.js. In the latter case, you could try the following steps:
Remember to include the version of Next.js and '!subteam^S01J8LPFU8N|@deepgram/sdk' you're using, as well as relevant snippets of your code. This will help the maintainers understand and address your issue more effectively.
|
Beta Was this translation helpful? Give feedback.
-
I am having the same issue, doesnt seem to work out of the box with turbopack. is there a way to configure it, or is there any update? Here is the GH issue, deepgram/deepgram-js-sdk#346 thanks |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Right now it appears to be incompatible with Next.js 15, and we may need to release a specific Next.JS library, so as to not complicate the SDK any further.
We have working examples in Next.js 14, so if you do not require any of 15s features then you could downgrade.