Next.js 15 ReferenceError: Cannot access 'isBrowser' before initialization #1020
Replies: 4 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.
-
In the clean project Next 15 made a form:
import { createClient } from "@deepgram/sdk";
export default function FormLoadAudio() {
async function handleUpload(dataForm: FormData) {
'use server';
const deepgram = createClient(process.env.DEEPGRAM_API_KEY ?? "");
}
return (
Load Audio
Submit
);
}
When calling a function createClient the browser displays an error:
Server Error
ReferenceError: Cannot access 'isBrowser' before initialization
How can I fix this error?
(There is a DEEPGRAM_API_KEY key in .env.local)
Beta Was this translation helpful? Give feedback.
All reactions