Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3] The server must emit the COOP/COEP response headers to enable those (Warning) #2997

Open
pieterjanmaes opened this issue Jan 18, 2025 · 4 comments
Labels
question Further information is requested v3

Comments

@pieterjanmaes
Copy link

Hi,

When I navigate with NuxtLink I get following warning when I navigate the first time:

Ignoring inability to install OPFS sqlite3_vfs: Cannot install OPFS: Missing SharedArrayBuffer and/or Atomics. The server must emit the COOP/COEP response headers to enable those. See https://sqlite.org/wasm/doc/trunk/persistence.md#coop-coep

How can I add COOP/COEP response headers to the queryCollection composable?

dependencies used:

  • "@nuxt/content": "^3.0.0"
  • "nuxt": "^3.15.2"
  • "vue": "latest"
  • "vue-router": "latest"
@lenndewolten
Copy link

lenndewolten commented Jan 21, 2025

I encountered the same issue when deploying on Cloudflare Pages and resolved it by specifying the missing headers.
To fix this create a _headers file in the root directory of your project with the following content:

/*
  Cross-Origin-Opener-Policy: same-origin
  Cross-Origin-Embedder-Policy: require-corp

These headers are required for enabling cross-origin isolation, which allows features like OPFS.
The /* is a wildcard that enables these headers on every url.

A redeploy will resolve the warning. If you are using a different hosting provider, the fix will be the same, but the method for specifying headers may differ.

@stafyniaksacha
Copy link

A workaround is to use nuxt-security module with:

export default defineNuxtConfig({
  modules: ['nuxt-security'],
  security: {
    headers: {
      crossOriginEmbedderPolicy: 'require-corp',
      crossOriginOpenerPolicy: 'same-origin', // or 'credentialless'
    },
  },
})

Note that by default contentSecurityPolicy will be enabled, which may break your app in production, setup according to your usage.

PikachuEXE added a commit to PikaSer-Cosmos/pikaser-website-main that referenced this issue Jan 28, 2025
PikachuEXE added a commit to PikaSer-Cosmos/pikaser-website-main that referenced this issue Jan 28, 2025
@PikachuEXE
Copy link

For vercel use https://vercel.com/guides/how-to-enable-cors but replace the headers

Though I still got Ignoring inability to install OPFS sqlite3_vfs: The OPFS sqlite3_vfs cannot run in the main thread because it requires Atomics.wait()...

@farnabaz
Copy link
Member

You can ignore this warning for the moment. It will be fixed in the next release.

Note that OPFS is required by SQLite-WASM to persist databases in browser storage. Nuxt Content does not use this feature; therefore, we can safely ignore it.

@farnabaz farnabaz added question Further information is requested v3 labels Jan 28, 2025
PikachuEXE added a commit to PikaSer-Cosmos/pikaser-website-main that referenced this issue Jan 29, 2025
PikachuEXE added a commit to PikaSer-Cosmos/pikaser-website-main that referenced this issue Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested v3
Projects
None yet
Development

No branches or pull requests

5 participants