Uncaught ReferenceError: navigator is not defined

I am getting error :

:warning: Something went wrong with the request to Cloudflare…
Uncaught ReferenceError: navigator is not defined
at line 300

Below is the code :

async function handleRequest(request) {

ScanditSDK.BarcodePicker.create(document.getElementById(“scandit-barcode-picker”), {
playSoundOnScan: true,
vibrateOnScan: true,
}).then(function (barcodePicker) {
// barcodePicker is ready here to be used (rest of the tutorial code should go here)

const scanSettings = new ScanditSDK.ScanSettings({
enabledSymbologies: [ScanditSDK.Barcode.Symbology.EAN8, ScanditSDK.Barcode.Symbology.EAN13],
codeDuplicateFilter: 1000, // Minimum delay between duplicate results

barcodePicker.on(“scan”, (scanResult) => {
scanResult.barcodes.reduce((string, barcode) => {
return string + ${ScanditSDK.Barcode.Symbology.toHumanizedName(barcode.symbology)}: ${barcode.data}\n;
}, “”)


The navigator interface is a browser/window thing.

Cloudflare has added navigator.userAgent by default if your compatibility date is newer than 2022-03-21 - https://developers.cloudflare.com/workers/platform/compatibility-dates/#global-navigator

If your libraries/dependencies rely on more of navigator than that, it’ll be time for polyfills (or investigating if that dependency will work at all in the Workers environment).

Thanks ! I was able to resolve that by changing the compatibility_date. But now I am getting below error:

Uncaught ReferenceError: document is not defined

You have any idea how to resolve this or any workaround ?