wxt-dev / wxt-dev/wxt

Enable Umami analytics generate error in offscreen

Open
#2,594 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending-triage
Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

I'm provide umami analytics in my extension

app.config.ts
export default defineAppConfig({ analytics: { enabled: storage.defineItem("local:enabled", { init: () => false }), userId: storage.defineItem("local:key", { init: () => crypto.randomUUID() as string | undefined }), userProperties: storage.defineItem("local:properties-key", { init: () => ({}) }), providers: [ umami({ apiUrl: umamiApiUrl, websiteId: umamiWebsiteId, domain: umamiDomain }) ] } });
And I have offscreen that run with my extension on browser run

background.ts
`
(async () => {
const contexts = await browser.runtime.getContexts({
contextTypes: [browser.runtime.ContextType.OFFSCREEN_DOCUMENT]
});

if (!contexts.length) {
  await browser.offscreen.createDocument({
    url: "/offscreen.html",
    reasons: ["DOM_SCRAPING"],
    justification: "Some reason"
  });
}

await waitForOffscreenReady();

})();
`

With this I got error in offscreen

Uncaught (in promise) Error: You must add the 'storage' permission to your manifest to use 'wxt/storage'
even when I have storage in my manifest

Reproduction

Enable umami in app with described steps

Steps to reproduce

No response

System Info
Mac os,
Used Package Manager

pnpm

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the storage permission handling from app.config.ts into the generated offscreen context, then compare it with the background.ts setup and manifest output. Reproduce the Umami configuration with offscreen.html and verify that the offscreen context no longer reports a missing storage permission when the manifest includes it.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.