{"record":{"id":"b94b4d70579bee9c","repo":"actualbudget/actual","slug":"geolocation-is-not-supported-by-this-browser","errorCode":null,"errorMessage":"Geolocation is not supported by this browser","messagePattern":"Geolocation is not supported by this browser","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/desktop-client/src/payees/location-adapters.ts","lineNumber":39,"sourceCode":"    coordinates: LocationCoordinates,\n  ): Promise<string>;\n  getLocations(payeeId: string): Promise<PayeeLocationEntity[]>;\n  deleteLocation(locationId: string): Promise<void>;\n  getNearbyPayees(\n    coordinates: LocationCoordinates,\n    maxDistance: number,\n  ): Promise<NearbyPayeeEntity[]>;\n};\n\n/**\n * Browser implementation of geolocation using the Web Geolocation API\n */\nexport class BrowserGeolocationAdapter implements GeolocationAdapter {\n  async getCurrentPosition(\n    options: PositionOptions = {},\n  ): Promise<LocationCoordinates> {\n    if (!navigator.geolocation) {\n      throw new Error('Geolocation is not supported by this browser');\n    }\n\n    const defaultOptions: PositionOptions = {\n      enableHighAccuracy: true,\n      timeout: 15000, // 15 second timeout\n      maximumAge: 60000, // Accept 1-minute-old cached position\n    };\n\n    const position = await new Promise<GeolocationPosition>(\n      (resolve, reject) => {\n        navigator.geolocation.getCurrentPosition(resolve, reject, {\n          ...defaultOptions,\n          ...options,\n        });\n      },\n    );\n    return {\n      latitude: position.coords.latitude,","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/desktop-client/src/payees/location-adapters.ts#L21-L57","documentation":"BrowserGeolocationAdapter.getCurrentPosition checks navigator.geolocation before calling the browser API and throws 'Geolocation is not supported by this browser' when it is absent. This is a capability guard: some browsers/contexts do not expose the Geolocation API, so the adapter fails fast instead of throwing an opaque TypeError.","triggerScenarios":"Calling position/getCurrentPosition in a browser without Geolocation support, in a non-secure (http://) context where geolocation is disabled, inside an iframe without allow=\"geolocation\", or in environments where navigator is stubbed.","commonSituations":"Insecure origins (plain HTTP) where Chrome/Firefox disable geolocation; embedded webviews (some Electron/webview configs) lacking the API; feature-detection being skipped during SSR or tests with mocked globals.","solutions":["Serve the app over HTTPS (or localhost) so the browser exposes navigator.geolocation","Feature-check navigator.geolocation before invoking and show a graceful fallback UI","For iframes, add allow=\"geolocation\" to the iframe element","In Electron/webview builds, enable the geolocation permission handler or supply a custom GeolocationAdapter"],"exampleFix":"// before\nconst coords = await adapter.getCurrentPosition();\n// after\nif (!('geolocation' in navigator)) {\n  toast('Location is unavailable in this browser');\n} else {\n  const coords = await adapter.getCurrentPosition();\n}","handlingStrategy":"fallback","validationCode":"if (typeof navigator === 'undefined' || !('geolocation' in navigator)) {\n  console.warn('Geolocation unavailable — offer manual location entry');\n}\nconst isSecureContextOk = typeof window !== 'undefined' && window.isSecureContext;","typeGuard":"const supportsGeolocation = (nav: Navigator | undefined): nav is Navigator & { geolocation: Geolocation } =>\n  !!nav && 'geolocation' in nav && typeof nav.geolocation.getCurrentPosition === 'function';","tryCatchPattern":"try {\n  const coords = await adapter.getCurrentPosition();\n} catch (err) {\n  if (err.message === 'Geolocation is not supported by this browser') {\n    promptForManualLocation(); // e.g. search by payee name/city instead\n  } else throw err;\n}","preventionTips":["Serve the app over HTTPS or localhost — geolocation is blocked on insecure origins","Feature-detect 'geolocation' in navigator before showing location-dependent UI","For iframes, include allow=\"geolocation\" on the iframe tag","In Electron, configure the session permission request handler to approve geolocation"],"tags":["browser","geolocation","compatibility"],"backgroundTag":"unsupported-browser-api","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}