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.

Any environment other than development fails to load JavaScript resources

See original GitHub issue

Describe the bug

When specifying ASPNETCORE_ENVIRONMENT as a value other than development, you get 404 errors for the ChartJs _content resources.

Which Blazor project type is your bug related to?

  • Server-Side

Which charts does this bug apply to?

all charts

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of ChartJSBlazor ‘1.1.0’.
  2. With this code.
  3. Run ASPNETCORE_ENVIRONMENT=production dotnet run from the project root, or use the VSCode run task in the sample project
  4. See error.

Expected behavior

The scripts load successfully

Screenshots

Screenshot 2020-06-14 at 15 55 37

Additional context / logging

[2020-06-14T14:50:17.862Z] Information: Normalizing '_blazor' to 'https://localhost:5001/_blazor'. blazor.server.js:1:5212
Loading failed for the <script> with source “https://localhost:5001/_content/ChartJs.Blazor/moment-with-locales.min.js”. localhost:5001:76:1
Loading failed for the <script> with source “https://localhost:5001/_content/ChartJs.Blazor/Chart.min.js”. localhost:5001:79:1
Loading failed for the <script> with source “https://localhost:5001/_content/ChartJs.Blazor/ChartJsBlazorInterop.js”. localhost:5001:82:1
[2020-06-14T14:50:18.046Z] Information: WebSocket connected to wss://localhost:5001/_blazor?id=FHaTttdw29shyxT33frTkQ. blazor.server.js:1:5212
[2020-06-14T14:50:18.462Z] Error: There was an unhandled exception on the current circuit, so this circuit will be terminated. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json' or set 'CircuitOptions.DetailedErrors'. blazor.server.js:15:27309
[2020-06-14T14:50:18.464Z] Information: Connection disconnected. blazor.server.js:1:5212

Code example

a.zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
ghostcommented, Jun 14, 2020

Yeah that’s right, everything’s taken from the readme, no further changes were made.

0reactions
Joelius300commented, Jun 14, 2020

Awesome, thank you 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find JS files -- Failed to load resource: the server ...
1 Answer 1 ... Scripts folder should be inside the wwwroot folder in order for the server to find them. To serve static...
Read more >
Custom JavaScript not working across all environments for ...
The weird thing is that this works perfectly fine in our Development Environment but doesn't on any of the other environments.
Read more >
Failing to load JavaScript
I just uploaded a website from GitHub. On my local environment, it works fine but once I uploaded it to Netlify, the buttons...
Read more >
Application Insights JavaScript SDK troubleshooting
Learn how to troubleshoot SDK load failure for JavaScript web applications, Azure Application Insights for web pages, and source map support ...
Read more >
Handling common JavaScript problems - MDN Web Docs
Maybe not so simple, but this article should at least give you a start, and some ideas on how to tackle the JavaScript-related...
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