Skip to content

Bug: unhandled promise rejection from bundled localforage on every server boot/restart (Driver not found / No available storage method found) #1213

Description

@kalebh70

Development Issue

Unsure — not sure if this is tied to active WIP work on the phone or a genuine regression, reporting as observed.

Phone Version

3.15.1-beta.2 (from fxmanifest.lua)

Issue Description

Every time npwd starts (fresh boot or a plain resource restart), the server console immediately logs three unhandled promise rejections from dist/game/server/server.js, right after "Started resource npwd":

(node:XXXX) ExperimentalWarning: localStorage is not available because --localstorage-file was not provided.
(Use `node --trace-warnings ...` to show where the warning was created)
[warn] [js] Unhandled promise rejection in resource npwd
[warn] [js] Uncaught Error: Driver not found.
dist/game/server/server.js(5138,130): getDriver
dist/game/server/server.js(5199,28):
node:internal/process/task_queues(104,5): processTicksAndRejections

[warn] [js] Unhandled promise rejection in resource npwd
[warn] [js] Uncaught Error: Driver not found.
dist/game/server/server.js(5138,130): getDriver
dist/game/server/server.js(5199,28):
node:internal/process/task_queues(104,5): processTicksAndRejections

[warn] [js] Unhandled promise rejection in resource npwd
[warn] [js] Uncaught Error: No available storage method found.
dist/game/server/server.js(5207,27):
node:internal/process/task_queues(104,5): processTicksAndRejections

It's non-fatal — npwd finishes starting fine and the phone works — but it's noisy on every boot/restart, and it's an unhandled rejection rather than something caught and logged cleanly.

What I've traced so far (server-side dist/game/server/server.js, so happy to share the exact bundle if useful):

  • localforage is bundled in, and as far as I can find, its only consumer anywhere in the file is @sentry/integrations's Offline plugin, constructed with localforage.createInstance({ name: "sentry/offlineEventStore" }). That plugin only gets wired up if Sentry.init() runs, which is itself gated by config.debug.sentryEnabled && process.env.NODE_ENV === "production".
  • To test that theory, I set sentryEnabled: false in config.json and restarted just the npwd resource. The exact same three errors still fired, byte-for-byte identical stack traces. So either something else in the bundle also reaches localforage, or there's a second sentryEnabled/debug config baked into the compiled output at build time that isn't actually being overridden by the runtime config.json — I did notice what looks like a duplicate debug: { ..., sentryEnabled: true } object elsewhere in the same bundle, separate from the one read from config.json, but wasn't able to confirm which one is actually live from static reading alone.
  • Root cause either way looks like localforage (a browser storage abstraction — IndexedDB/WebSQL/localStorage) ending up in a code path that executes in the server-side Node context, where none of its backends exist. Node's own experimental localStorage global (gated behind --localstorage-file) isn't something we can pass through, since this environment embeds Node directly via libnode inside the server binary rather than spawning a standalone node process that would read that flag.

Issue Reproduction

  1. Start (or restart npwd) a standard FXServer running npwd with default/near-default config.json.
  2. Watch the server console right after Started resource npwd.
  3. See the three unhandled promise rejections above.

Evidence

Environment this was observed on: FiveM for GTA V Enhanced (Gen9), CitizenFX early-access cfx-server.exe build, embedded libnode26.dll (Node 26), Qbox Project framework. Flagging the Enhanced/Node-26 detail specifically in case this doesn't reproduce on Legacy/older embedded Node versions — wasn't able to cross-check against Legacy in this session.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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