How to inject manifest.json and sw.js for a PWA SaaS app? Blocked by themeFilesUpsert permissions

Hi everyone,

We’re building a PWA SaaS platform and developing a Shopify app with the goal of turning a merchant’s store into an installable Progressive Web App (PWA) after installing our app.

To achieve this, we need to inject two files into the merchant’s theme automatically:

  • manifest.json
  • sw.js (Service Worker)

Our current approach:

We’re using the GraphQL API with the themeFilesUpsert mutation to write these files into the theme directory. However, we encountered this error:

json

复制编辑

{
  "message": "Access denied for themeFilesUpsert field. Required access: The user needs write_themes and an exemption from Shopify to modify theme files.
If you think that your app is eligible for an exemption and should have access to this API, then you can [submit an exception request](https://docs.google.com/forms/d/e/1FAIpQLSfZTB1vxFC5d1-GPdqYunWRGUoDcOheHQzfK2RoEFEHrknt5g/viewform)."
}

We’ve already requested the write_themes scope and submitted the form linked in the error message, but haven’t received any response for weeks.


We’d really appreciate guidance on:

  1. Is there any other way to inject these files (e.g., ScriptTag API or App Proxies)?
  2. Has anyone successfully obtained an exemption for themeFilesUpsert? How long did it take? Any tips to expedite approval?
  3. Would using a Theme App Extension + App Proxy be a better approach for manifest and service worker injection?

We’re committed to developing in a compliant, responsible way — we won’t make destructive changes to the theme, and we aim only to improve mobile performance and user experience.

Thanks in advance for any advice or experience you can share!

Hi @huixuan_biao

Is it possible to inject these two dependencies at runtime instead?

I assume manifest.json can’t be injected as a <script> tag, so the Script API won’t be an option.

But you should be able to register the sw.js as a <script> tag and scope it to the ONLINE_STORE so it’s available on all pages, regardless of the installed theme.