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

x-nuxt-no-ssr header: globalThis.__buildAssetsURL is not a function #15124

Closed
Alex--C opened this issue Oct 10, 2022 · 0 comments · Fixed by nuxt/framework#8106
Closed

x-nuxt-no-ssr header: globalThis.__buildAssetsURL is not a function #15124

Alex--C opened this issue Oct 10, 2022 · 0 comments · Fixed by nuxt/framework#8106

Comments

@Alex--C
Copy link
Contributor

Alex--C commented Oct 10, 2022

Environment


  • Operating System: Linux
  • Node Version: v14.19.3
  • Nuxt Version: 3.0.0-rc.11
  • Nitro Version: 0.5.4
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: ssr, css
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://codesandbox.io/s/distracted-cookies-x37yoi?file=/assets/css/main.css

(Let me know if that link does not work for you)

Describe the bug

We have a server middleware to dynamically enable/disable SSR depending on the user agent.

In nuxt.config.ts we set ssr: true, our middleware then overrides this using

event.req.headers['x-nuxt-no-ssr'] = 'true';

if serving a user agent that should not get server side rendering.

This leads to problems when using assets in CSS files:

[nuxt] [request error] [unhandled] [500] globalThis.__buildAssetsURL is not a function
  at ./.output/server/chunks/app/styles.mjs:7:276
  at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
  at async Promise.all (index 0)
  at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
  at async renderInlineStyles (./.output/server/chunks/handlers/renderer.mjs:453:20)
  at async ./.output/server/chunks/handlers/renderer.mjs:386:25
  at async ./.output/server/chunks/handlers/renderer.mjs:30:22
  at async ./.output/server/node_modules/h3/dist/index.mjs:592:19
  at async Server.nodeHandler (./.output/server/node_modules/h3/dist/index.mjs:538:7)

Note that this only happens in production mode, dev mode is fine.

Additional context

No response

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants