Skip to content

bug: ReferenceError: indexedDB is not defined #1109

@smartchainark

Description

@smartchainark

Is there an existing issue for this?

Which method was used to setup Scaffold-ETH 2 ?

git clone

Current Behavior

When running yarn dev (or npm run dev) for my Next.js application, I encounter a ReferenceError: indexedDB is not defined error. This error indicates that browser-specific indexedDB API is being accessed in a Node.js environment. The issue happens during the compilation phase of a specific page (/bot-manager) and prevents a clean startup, although the server eventually becomes "Ready" and the page is accessible.
The error also manifests as unhandledRejection messages, suggesting an asynchronous operation attempting to use indexedDB in the server environment.
Despite trying NODE_OPTIONS='--trace-uncaught', a detailed stack trace pinpointing the exact problematic line of code is not immediately visible in the console output.
Error Log:
dev@devdeMacBook-Air nextjs % NODE_OPTIONS='--trace-uncaught' yarn dev

▲ Next.js 15.2.5

✓ Starting...
✓ Ready in 2.2s
○ Compiling /bot-manager ...
✓ Compiled /bot-manager in 10.3s (7503 modules)
[ReferenceError: indexedDB is not defined]
⨯ unhandledRejection: [ReferenceError: indexedDB is not defined]
⨯ unhandledRejection: [ReferenceError: indexedDB is not defined]
[ReferenceError: indexedDB is not defined]
⨯ unhandledRejection: [ReferenceError: indexedDB is not defined]
⨯ unhandledRejection: [ReferenceError: indexedDB is not defined]
GET /bot-manager 200 in 12333ms
HEAD /bot-manager 200 in 114ms
Use code with caution.
Reproduce Steps:
Clone the repository (if applicable).
Install dependencies: yarn or npm install.
Run the development server: yarn dev or npm run dev.
Observe the console output. The ReferenceError appears during the compilation of /bot-manager.
Expected Behavior:
The Next.js development server should start without ReferenceError related to browser-specific APIs, indicating that all code executed in the Node.js environment is compatible.
Actual Behavior:
A ReferenceError: indexedDB is not defined is thrown in the console during the compilation and startup of the /bot-manager page, along with unhandledRejection warnings.
Environment:
Next.js Version: 15.2.5
Node.js Version: (Please fill in your Node.js version, e.g., v18.17.0)
Operating System: macOS (dev@devdeMacBook-Air)
Yarn Version: (Please fill in your Yarn version, e.g., 1.22.19)

Expected Behavior

No response

Steps To Reproduce

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions