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

fix: SSR app does not work on Mac Safari - but works on Chrome #186

Closed
walsha2 opened this issue Mar 15, 2024 · 2 comments
Closed

fix: SSR app does not work on Mac Safari - but works on Chrome #186

walsha2 opened this issue Mar 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@walsha2
Copy link
Contributor

walsha2 commented Mar 15, 2024

Chrome

Run any basic SSR app as normal and compare the instance opened on Chrome and on Safari. I keep seeing this console message in the Chrome browser:

Refused to execute script from 'http://localhost:4322/main.dart.js' because its 
MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

However, everything seems to work fine on Chrome. The server/client side code work as expected.

Safari MacOS

With the app still running, open in a Safari browser on MacOS. Things are more catastrophic here and the server actually responds with a 500 (Internal Server Error).

The Content-Type warning may be a clue as to why this may be happening and why the server error only happens on Safari.

Browser Console

[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (app.client.dart.bootstrap.js, line 0)
[Error] Refused to execute http://localhost:8080/@http://localhost:8080/components/app.client.dart.bootstrap.js as script because "X-Content-Type-Options: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Error: Script error for "app.client.dart.bootstrap"
http://requirejs.org/docs/errors.html#scripterror
	defaultOnError (require.js:143)
	onError (require.js:549)
	onScriptError (require.js:1738)

Jaspr Server

[SERVER] [ERROR] GET /@http://localhost:8080/components/app.client.dart.bootstrap.js
[SERVER] [ERROR] Error thrown by handler.
[SERVER] [ERROR] FormatException: Scheme not starting with alphabetic character (at character 1)
[SERVER] [ERROR] @http://localhost:8080/components/app.client.dart.bootstrap.js
[SERVER] [ERROR] ^
[SERVER] [ERROR] dart:core                                           _SimpleUri.resolve
[SERVER] [ERROR] package:shelf_proxy/shelf_proxy.dart 42:28          proxyHandler.<fn>
[SERVER] [ERROR] package:jaspr/src/server/server_handler.dart 74:32  _proxyHandler.<fn>

Reproduce

Steps To Reproduce

jaspr create (basic)
jaspr serve

Doctor Output

[✓] Jaspr CLI (Version 0.10.0)
  • Dart Version 3.3.1 (stable) (Wed Mar 6 13:09:19 2024 +0000) on "macos_arm64"
  • Running on macos Version 14.4 (Build 23E214) - Locale en-US
  • Analytics: Enabled

[✓] Current Project
  • Dependencies on core packages:
    • jaspr: ^0.10.0 (git -> main)
    • jaspr_builder: ^0.10.0 (git -> main)
    • jaspr_riverpod: ^0.3.9
    • jaspr_router: ^0.3.1
  • Uses server-side rendering: true
  • Uses experimental compilers: false
  • Uses flutter embedding: false
@walsha2 walsha2 added the bug Something isn't working label Mar 15, 2024
@schultek
Copy link
Owner

Looks like a duplicate of #58

@walsha2
Copy link
Contributor Author

walsha2 commented Mar 15, 2024

Looks like a duplicate of #58

Yea I think so. We can close this issue in favor of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants