-
-
Notifications
You must be signed in to change notification settings - Fork 584
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
Error: global is not defined - when creating a matrix client #4450
Comments
I think matrix-js-sdk currently expects the environment to provide a polyfill for I am very surprised that you found this started with 34.4.0, because as far as I know this code has not changed in years. As for solutions: pull-requests to replace In the meantime, maybe you can work around it. I'm not familiar with next.js but maybe you can configure it to provide a polyfill? Alternatively, if you provide a concrete implementation of let store = new MemoryStore({ localStorage });
let client = createClient({ store }); |
Matrix SDK is not compatible with the latest version of Next.js (14.2.15). Creating a client causes an error in the
amendClientOpts
function, where it uses theglobal
variable, which is not defined in this environment. The error started occurring with matrix-js-sdk version 34.4.0. The error appears on this line, but the global variable is used multiple times.The code is simple. Here’s an example.
Here, I have a screenshot of the error.
The browser recognizes
globalThis
but notglobal
.global
is available only in a node.js environment. How can I run Matrix on Next.js? Thanks in advance for the help.The text was updated successfully, but these errors were encountered: