Skip to content

Fix ReferenceError: indexedDB is not defined during SSR#140

Merged
Adebesin-Cell merged 2 commits intomainfrom
fix/index-db-error
Feb 3, 2026
Merged

Fix ReferenceError: indexedDB is not defined during SSR#140
Adebesin-Cell merged 2 commits intomainfrom
fix/index-db-error

Conversation

@Adebesin-Cell
Copy link
Copy Markdown
Member

@Adebesin-Cell Adebesin-Cell commented Feb 3, 2026

Closes https://github.com/EveripediaNetwork/issues/issues/4705 when this PR merged

Related:

Description

This PR fixes a server-side rendering (SSR) crash caused by browser-only APIs being accessed during server execution.

The issue occurred when wagmi connectors were initialized during SSR. Since APIs like indexedDB are not available in a Node.js environment, this resulted in a ReferenceError and caused Next.js to fail during server rendering.

To resolve this, connector initialization is now gated to run only in the browser.

Summary of Changes

  • Prevents wagmi connectors from initializing in a server environment.
  • Ensures connectors are only created when running in the browser.
  • Returns an empty connectors array during SSR to avoid accessing browser-specific APIs.

Result

  • Fixes unhandled promise rejections during Next.js server rendering.
  • Prevents ReferenceError: indexedDB is not defined.
  • Aligns behavior with similar fixes in related projects (see links above).

Closes

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 3, 2026

🦋 Changeset detected

Latest commit: 2a9c9ee

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@everipedia/iq-login Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @Adebesin-Cell, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue causing application crashes during server-side rendering by preventing the initialization of browser-specific APIs in a Node.js environment. The change ensures that components requiring client-side capabilities are only instantiated when the application is running in a browser, thereby stabilizing the SSR process and eliminating runtime errors related to undefined browser objects.

Highlights

  • SSR Crash Fix: This pull request resolves a ReferenceError: indexedDB is not defined that occurred during server-side rendering (SSR). The error was caused by wagmi connectors attempting to access browser-only APIs in a Node.js environment.
  • Conditional Connector Initialization: The initialization of wagmi connectors (injected, WalletConnect, and Web3AuthConnector) is now gated by a typeof window !== "undefined" check. This ensures connectors are only created when running in a browser environment, returning an empty array during SSR.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/config/iq-login.config.ts
    • Modified the createIqLoginConfig function to conditionally define the connectors array.
    • Introduced a typeof window !== "undefined" check to ensure injected(), walletConnect(), and Web3AuthConnector() are only called in a browser context.
    • The connectors property in createConfig now receives either the full set of initialized connectors or an empty array, depending on the execution environment.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Adebesin-Cell Adebesin-Cell merged commit 553cab8 into main Feb 3, 2026
@Adebesin-Cell Adebesin-Cell deleted the fix/index-db-error branch February 3, 2026 16:13
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses a server-side rendering crash by preventing wagmi connectors from being initialized in a non-browser environment. The approach of checking for typeof window !== "undefined" is appropriate. I've added one comment regarding the unconditional creation of web3AuthInstance, which might also need to be guarded to make the SSR behavior fully robust, as Web3Auth libraries often require special handling for SSR.

Comment thread src/config/iq-login.config.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant