question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JS assets are pulling twice when use app.cdnURL

See original GitHub issue

Environment


  • Operating System: Darwin
  • Node Version: v16.14.0
  • Nuxt Version: 3.0.0-rc.1-27515112.2d202b5
  • Package Manager: yarn@1.22.18
  • Builder: vite
  • User Config: components, autoImports, plugins, runtimeConfig, buildModules, modules, app, partytown, intlify, build, nitro, css, serverMiddleware, hooks
  • Runtime Modules: @nuxtjs/partytown@1.1.2
  • Build Modules: @pinia/nuxt@0.1.8, @intlify/nuxt3@0.1.10

Reproduction

export default defineNuxtConfig({
  // nuxtApp configuration
  app: {
     cdnURL: 'CDN_BASE_URL'
  }
})

Describe the bug

When we use cdnURL option it is calling js file twice one from CDN and another one from app root

Screenshot 2022-04-26 at 6 23 27 PM Screenshot 2022-04-26 at 6 22 49 PM Screenshot 2022-04-26 at 6 19 31 PM

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
anish2690commented, Apr 28, 2022

@danielroe Able to reproduce the issue here https://github.com/anish2690/nuxt3-cdn-url-issue

When you have a SFC under layout (with imports) this issue can be reproducible on run time.

0reactions
duncanjmathesoncommented, May 5, 2022

Glad you managed to reproduce it, I was about to try to make a reproduction myself.

FWIW, this seems to be a critical everything-breaking bug if the app url cannot serve those files, and the cdn must be used.

My prod setup: user connects to Wordpress site, which connects to static js site for SSR. SSR is delivered as part of Wordpress render, and shows correctly. The browser then attempts to load the the js - and it must use the CDN url, because the app url is the Wordpress site which doesn’t have those files - so an mjs file gets a 404. The incorrect loading then breaks the javascript on the page.

This setup worked as of 3.0.0-27386975.6e06d2b, haven’t narrowed it down further at this stage.

Edit: I guess the breaking issue is technically #3932 but as you mentioned above they are likely the same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding and Leveraging a CDN on Your Website | CSS-Tricks
Your CDN URL is the URL all of your assets will point to once things have been set up. A good rule of...
Read more >
How to Speed Up WordPress Asset Delivery ... - DigitalOcean
With the Assets Pull addon, it can identify assets (CSS, JS, images, etc) used by your site (for example by WordPress themes) and...
Read more >
Deployment race condition causing CDN to cache old or ...
As a general rule of thumb: Don't do live upgrades. (unless the language supports it, but even then think twice). Pulling code using...
Read more >
Setup Discourse with KeyCDN - sysadmin
Create a Pull Zone within the KeyCDN dashboard and enter the origin url of your Discourse instance. · Update your app. · Rebuild...
Read more >
8th Wall Documentation
Built entirely using standards-compliant JavaScript and WebGL, 8th Wall Web ... 8th Wall works within iOS 13 apps that use SFSafariViewController web views....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found