jaspr icon indicating copy to clipboard operation
jaspr copied to clipboard

Problem with Safari Browser: FormatException: Scheme not starting with alphabetic character (at character 1)

Open timbrueckner opened this issue 2 years ago • 6 comments

I started with the quick start guide on https://docs.page/schultek/jaspr/quick-start. I created a project using the basic template, entered the working directory and ran the serve command. I did not open the project in an IDE or edited any files.

When the page is up, I open the browser and visit localhost:8080. I see a white page with »Hello World«, but an error gets logged on the server. It seems as if there is an @ symbol in front of the scheme in the generated code.

FormatException: Scheme not starting with alphabetic character (at character 1)

ERROR - 2023-03-31 17:36:08.922166

GET /@http://localhost:8080/app.app.dart.bootstrap.js
Error thrown by handler.
FormatException: Scheme not starting with alphabetic character (at character 1)
@http://localhost:8080/app.app.dart.bootstrap.js
^


dart:core                                           _SimpleUri.resolve
package:shelf_proxy/shelf_proxy.dart 42:28          proxyHandler.<fn>
package:jaspr/src/server/server_handler.dart 51:28  _webdevProxyHandler.<fn>
package:jaspr/src/server/server_handler.dart 34:55  RefreshableHandler.call
package:shelf_gzip/src/gzip_encoding.dart 44:44     createGzipMiddleware.<fn>.<fn>.<fn>
dart:async                                          new Future.sync
package:shelf_gzip/src/gzip_encoding.dart 44:21     createGzipMiddleware.<fn>.<fn>

This is my pubspec.yaml:

name: jaspr_website
description: A basic pure-dart web app with ssr & automatic client hydration.
version: 0.0.1

environment:
  sdk: '>=2.17.0 <3.0.0'

dependencies:
  jaspr: ^0.2.0+4

dev_dependencies:
  build_runner: ^2.2.0
  build_web_compilers: ^3.2.1
  jaspr_builder: ^0.2.0
  lints: ^2.0.1

jaspr --version returns 0.1.0 dart --version returns Dart SDK version: 2.19.6 (stable)

I am using Safari on macOS.

image

UPDATE: This issue does not occur using Chrome.

timbrueckner avatar Mar 31 '23 15:03 timbrueckner

Seems to be a webdev issue on Safari.

Reproducible through:

dart create -t web safari_test
cd safari_test
webdev serve

Please open an issue on the webdev repo: https://github.com/dart-lang/webdev

schultek avatar Apr 01 '23 21:04 schultek

Please open an issue on the webdev repo: https://github.com/dart-lang/webdev

I just found out, there is an existing issue at the webdev repo, already: https://github.com/dart-lang/webdev/issues/1499

timbrueckner avatar Apr 10 '23 20:04 timbrueckner

Interesting note from the linked dart-lang/webdev issue:

Adding on to it, this seems like a problem by dartdevc instead of webdev, because if I use webdev serve --release to force webdev to use dart2js, the problem goes away.

https://github.com/dart-lang/webdev/issues/1499#issuecomment-1383025694


@schultek I take this to mean that when deployed, there will not be any Safari related issues. This issue crops up just for local development. If so, I do not think this is too pressing... as long as it works in production.

I have yet to publish any jaspr apps so I havent confirmed, but that seems to be the case: https://jasprpad.schultek.de/ runs fine on Safari on MacOS.

walsha2 avatar Mar 15 '24 20:03 walsha2

Yes from my testing also this only affects dev mode.

schultek avatar Mar 15 '24 21:03 schultek

@schultek From yesterday it affects all web browsers. Auto refresh doesn't work at all.

adriank avatar Sep 19 '24 10:09 adriank

After reading the below issue I found a solution on how to be able to test on Safari

https://github.com/dart-lang/webdev/issues/1499#issuecomment-1383025694

jaspr server --release

MarkOSullivan94 avatar Nov 28 '24 01:11 MarkOSullivan94