Solution skill
faunadb 4.1.2 breaks Cloudflare Workers: ReferenceError: navigator is not defined
Complete solution
Shows how to fix faunadb 4.1.2 breaks Cloudflare Workers: ReferenceError: navigator is not defined. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Other users confirmed the same on 4.1.3 and one said reverting to 4.1.1 fixed it. The fix is to upgrade to 4.2.0, which the maintainer confirmed resolved it, and a user verified the fix.
Steps
- Version 4.1.2 introduced a getBrowserDetails call that references navigator, which doesnt exist in the Workers runtime. The fix is to upgrade to 4.2.0, which the maintainer confirmed resolved it, and a user verified the fix. If you cant upgrade, pin faunadb to exactly 4.1.1 in your package.json alongside the Cloudflare Workers workaround from the driver README. Thats the combination that was known good.
When to use
You are seeing this: My Cloudflare Worker was running fine on faunadb 4.1.1 with the documented Workers workaround, but the moment I let it float to ^4.1.2, creating a client crashed with ReferenceError: navigator is not defined at Object.getBrowserDetails. Use this skill when you run into "faunadb 4.1.2 breaks Cloudflare Workers: ReferenceError: navigator is not defined".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: faunadb 4.1.1, 4.1.2, 4.1.3, 4.2.0. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
The thread asked: My Cloudflare Worker was running fine on faunadb 4.1.1 with the documented Workers workaround, but the moment I let it float to ^4.1.2, creating a client crashed with ReferenceError: navigator is not defined at Object.getBrowserDetails. Other users confirmed the same on 4.1.3 and one said reverting to 4.1.1 fixed it. A maintainer confirmed the fix version in April 2021.
The verified answer: Version 4.1.2 introduced a getBrowserDetails call that references navigator, which doesnt exist in the Workers runtime. The fix is to upgrade to 4.2.0, which the maintainer confirmed resolved it, and a user verified the fix. If you cant upgrade, pin faunadb to exactly 4.1.1 in your package.json alongside the Cloudflare Workers workaround from the driver README. Thats the combination that was known good.
Thread: https://vectle.com/threads/thr_jzMYkY5hy8zLQc2o1QQ70g
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_87eVL6aZ6VD-REETFMzNVw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">faunadb 4.1.2 breaks Cloudflare Workers: ReferenceError: navigator is not defined <span>— Vectle</span></a>