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

studio-extensions.client.js served with incorrect mime type #44

Closed
techmunk opened this issue Jun 6, 2019 · 18 comments
Closed

studio-extensions.client.js served with incorrect mime type #44

techmunk opened this issue Jun 6, 2019 · 18 comments

Comments

@techmunk
Copy link

techmunk commented Jun 6, 2019

Just updated to the latest docker images. Can no longer load the studio.
The error is:
Refused to execute script from '/studio/assets/studio-extensions.client.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

The request comes back with key response headers of:

  • content-type: text/html; charset=utf-8
  • x-content-type-options: nosniff

We've removed the x-content-type-options: nosniff header from our reverse proxy and this fixes the issue for now but express should really be serving the file with the correct mime type. Jsreport 2.4.0 did not seem to have this issue.

@rconstantine
Copy link

I'm seeing the same issue. Will try to downgrade to 2.4.0.

@pofider
Copy link
Contributor

pofider commented Jun 12, 2019

My apologies. This problem was introduced in the 2.5.0.
I've fixed it now, so it will be included in the upcoming release.

@rconstantine
Copy link

OK. Thanks for the effort. I updated to latest jsreport (npm install --save jsreport@latest), and although the 2.5.1 version (of jsreport-studio) did come down with it, it's still throwing the same error. I realize I didn't mention before that the stand-alone server was working fine and this error only showed up when I attempted to integrate into an existing Express app. Then again, I see you commented on my forum thread, so you probably already know that.

I think I'll pull down 2.4 and run a compare.

@rconstantine
Copy link

Hmm. I see the line you added. Seems like it should work, but for some reason, when I inspect the file's header using the Network tab of the developer tools in chrome, it's still coming across as text/html. I have performed a hard refresh, so it shouldn't be using cached files. I'll look to see if I can tell why.

@rconstantine
Copy link

How about instead of res.send, you use res.jsonp? I think you're sending jsonp, aren't you? http://expressjs.com/en/api.html#res.jsonp

@rconstantine
Copy link

My bad. I'm a moron. jsreport@latest doesn't include the latest jsreport-studio. Updating separately (jsreport-studio@latest) doesn't seem to pull that change either, which is why nothing is different. How do I pull master of jsreport-studio instead of 2.5.1? I'll go google that.

@pofider
Copy link
Contributor

pofider commented Jun 12, 2019

Install as github depencency

npm i jsreport/jsreport-studio

@rconstantine
Copy link

rconstantine commented Jun 12, 2019

Crud. That worked in terms of getting the file updated in my project's node_modules folder, and when I open the studio.js file I see the change, but running the app I still get the same error.

I manually changed the send to res.jsonp(clientStudioExtensionsJsContent) and now that error goes away! So success there!

However, the other two errors remain (which weren't mentioned above). They say: "Error: Loading chunk 1 failed" and "Uncaught (in promise) Error: Loading chunk 1 failed"

@rconstantine
Copy link

Here's the first one: Error: Loading chunk 1 failed.
(missing: https://pharmacyinformatics.local:3000/reporting/studio/assets/studio-extensions.client.js)
at Function.i.e (client.js?e74d863926ba6fb1f82a:1)
at client.js?e74d863926ba6fb1f82a:72
at D.n._execute (client.js?e74d863926ba6fb1f82a:6)
at D._resolveFromExecutor (client.js?e74d863926ba6fb1f82a:6)
at new D (client.js?e74d863926ba6fb1f82a:6)
at t.default (client.js?e74d863926ba6fb1f82a:72)
at client.js?e74d863926ba6fb1f82a:32
at w (client.js?e74d863926ba6fb1f82a:32)
at Generator._invoke (client.js?e74d863926ba6fb1f82a:32)
at Generator.e. [as next] (client.js?e74d863926ba6fb1f82a:32)
at o (client.js?e74d863926ba6fb1f82a:6)
at client.js?e74d863926ba6fb1f82a:6
at new Promise ()
at new t (client.js?e74d863926ba6fb1f82a:6)
at client.js?e74d863926ba6fb1f82a:6
at client.js?e74d863926ba6fb1f82a:32

@rconstantine
Copy link

I can't tell why it says that file is missing. It shows as loaded now, on the Network tab of dev tools. And clicking on the link for it shows its contents! Perhaps there is an order of operations issue where the chunks are trying to be loaded before the file has been downloaded? I compared 2.4.0 to the latest and I'm unfamiliar with what you're trying to do with webpack, so I'm not much help.

@rconstantine
Copy link

Should I open a new issue for the above error instead of continuing this one?

@rconstantine
Copy link

Hmm. Not sure if this pertains: webpack/webpack#7502

@rconstantine
Copy link

Is it an issue that the file is loaded last? See image.

ScreenHunter_491 Jun  12 10 48

@rconstantine
Copy link

I rolled back to jsreport 2.4.0 and all is well. I'll wait for a fix before trying to upgrade. Thanks for looking into this. It's appreciated.

@bjrmatos
Copy link
Collaborator

related to https://forum.jsreport.net/topic/1090/integration-into-existing-express-application-error/3

i will try to find the time to check the express integration in your case. thanks

@c-andrey
Copy link

still having this problem on 3.1, can someone enlight-me?

@bjrmatos
Copy link
Collaborator

hi @c-andrey, it is likely an issue with the way you have integrated jsreport with your express app, there is no way we can know what can be wrong if you don't share how your app is setup.

i suggest you create a new issue, and provide more details, example code, or even a small repository that show how the integration is not working.

try to follow the basic integration here, and from there start to add things until you can reproduce your problem.

@c-andrey
Copy link

actually, its exactly what you said, the app integrated that was causing the conflict in the routes for the express

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

No branches or pull requests

5 participants