sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

A preload for '[AzureCDN]/hello-world-web-part_25beead865729ba82e5f.js' is found, but is not used because the request credentials mode does not match. Consider taking a look at crossorigin attribute.

Open MarksPoint opened this issue 1 year ago • 8 comments

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

macOS

What browser(s) / client(s) have you tested

  • [ ] 💥 Internet Explorer
  • [ ] 💥 Microsoft Edge
  • [X] 💥 Google Chrome
  • [ ] 💥 FireFox
  • [ ] 💥 Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [ ] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

  • browser version: Chrome Version 120.0.6099.109 (Official Build) (arm64)
  • SPFx version: 1.18.2 (but issue exists at least since 1.14)

Describe the bug / error

Deploying an SPFx solution to Azure CDN results in the following browser warning:

A preload for '[AzureCDN]/hello-world-web-part_25beead865729ba82e5f.js' is found, but is not used because the request credentials mode does not match. Consider taking a look at crossorigin attribute.

We've got our SPFx solutions deployed to Azure CDN, and we've been seeing this behaviour for a long time now. We're not sure about the actual performance impact because the script is eventually cached in browser (so re-loading should be fast), but nevertheless we feel like there's some performance improvement we're missing out on.

If I disable cache in my browser (devtools), and open something like Fiddler to inspect network traffic, I see the following two requests that both load the same script file, but seem to differentiate primarily in the cors/no-cors header:

image

I think the first request is for the 'preload', but the result of is discarded (according to the warning).

Looking at the HTML of the page, I see the <link tag that's responsible for the preload:

<link rel="preload" href="https://[AzureCDN]/hello-world-web-part_25beead865729ba82e5f.js" as="script" crossorigin>

Steps to reproduce

I followed these steps to create a new dummy web part that was then uploaded to Azure Storage:

https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/deploy-web-part-to-cdn

Additionally, I made the storage account anonymously accessible and I added the following CORS settings on the Blob service: image

This to prevent CORS errors that would otherwise appear, loading the script file(s).

Expected behavior

Preloading the script should work as expected, providing performance improvements to loading the (web part) script. The script should not be loaded twice.

MarksPoint avatar Dec 20 '23 14:12 MarksPoint

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Dec 20 '23 14:12 ghost

I understand that my question isn't an easy one, but I would really like to know if I'm doing something wrong or if there's something fishy at the SharePoint side of things. Bump?

MarksPoint avatar Jan 08 '24 14:01 MarksPoint

Anyone?

MarksPoint avatar Feb 09 '24 12:02 MarksPoint

I could really use some help or advice here... Since there's no reply so far, I'm not sure if my question is to vague, or the issue isn't reproducable, or it's just not high-prio enough, or...?

MarksPoint avatar Apr 16 '24 07:04 MarksPoint

I'll just start bumping this until someone replies... Not sure what else I can do to bring this to your attention.

MarksPoint avatar Apr 25 '24 09:04 MarksPoint

Help!

MarksPoint avatar May 15 '24 09:05 MarksPoint

@VesaJuvonen @shagra-ms This issue appears to have dropped from everyone's radar and I'm not sure how to bring this to your attention. Any ideas here? Maybe re-tag this one with Needs: Triage? Thanks!

MarksPoint avatar May 23 '24 14:05 MarksPoint

I think I'm running into this same issue. @VesaJuvonen @shagra-ms any updates?

andrewpeterson99 avatar Jun 25 '24 15:06 andrewpeterson99

@andrewconnell @AJIXuMuK could you shine a light on this? It's been open for ages and no one seems to want to reply...

MarksPoint avatar Jul 09 '24 10:07 MarksPoint

Have to yield to Microsoft on this... not sure why they wouldn't include "crossing=anonymous" to the preload (a way to get around the credential response).

andrewconnell avatar Jul 09 '24 10:07 andrewconnell

Thanks for the prompt reply, @andrewconnell. Is this something that you can take to MS, or is it something I should do?

MarksPoint avatar Jul 09 '24 15:07 MarksPoint

This issue also occurs for the customers who have the .js load error. in my case Not sure if they're linked or not.

andrewpeterson99 avatar Jul 10 '24 17:07 andrewpeterson99

Hello @MarksPoint, Thank you for bringing this issue to our attention. Could you please confirm if the issue still persists for you?

Amey-MSFT avatar Jul 07 '25 11:07 Amey-MSFT

Hi @Amey-MSFT,

Yes, absolutely! I just confirmed that I see this message in our production environment:

Image

MarksPoint avatar Jul 07 '25 11:07 MarksPoint

Hello, We were able to reproduce the issue, and we are investigating it. We have logged this as a bug, and our engineering team will look into it. Thank you!

Amey-MSFT avatar Jul 08 '25 12:07 Amey-MSFT

Any update on this issue? It's been open for so long now...

MarksPoint avatar Aug 21 '25 08:08 MarksPoint