Skip to content

build_runner build_runner serve --live-reload doesn't reload on changes #3379

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

Closed
jhenso opened this issue Oct 17, 2022 · 5 comments
Closed
Labels
closed-stale Closed as the issue or PR is assumed stale. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@jhenso
Copy link

jhenso commented Oct 17, 2022

Hello, according to build_runner documentation:

Some commands also have additional options:

serve
--hostname: The host to run the server on.
--live-reload: Enables automatic page reloading on rebuilds.

However if you run dart run build_runner serve --live-reload, the application is built and served, but live-reload doesn't work, with the following error when the browser tries to connect to the WebSocket:

Serving `web` on http://localhost:8080
ERROR - 2022-10-17 10:06:11.398101
Asynchronous error
NoSuchMethodError: Closure call with mismatched arguments: function 'BuildUpdatesWebSocketHandler.createHandlerByRootDir.closureForRootDir'
Receiver: Closure: (WebSocketChannel, String) => void
Tried calling: BuildUpdatesWebSocketHandler.createHandlerByRootDir.closureForRootDir(Instance of 'WebSocketChannel')
Found: BuildUpdatesWebSocketHandler.createHandlerByRootDir.closureForRootDir(WebSocketChannel, String) => void
dart:core                                                   _objectNoSuchMethod
package:shelf_web_socket/shelf_web_socket.dart 49:55        webSocketHandler.<fn>
package:shelf_web_socket/src/web_socket_handler.dart 81:20  WebSocketHandler.handle.<fn>

Repository with minimal reproduction: https://github.com/jhenso/dart-build-runner

  • Dart SDK Version (dart --version)
    Dart SDK version: 2.18.2 (stable) (Tue Sep 27 13:24:11 2022 +0200) on "macos_x64"

  • What package(s) from this repo you are using, and the version (i.e. build_runner 0.7.12)

  • build_runner 2.3.0
  • build_runner_core 7.2.4
  • build_web_compilers 3.2.6
  • Whether you are using Windows, MacOSX, or Linux (if applicable)
    MacOSX
  • Whether you are using Chrome, Safari, Firefox, Edge (if applicable)
    Chrome
@jakemac53
Copy link
Contributor

cc @grouma I think we maybe added a client ID to this so we could have multiple channels?

@grouma
Copy link
Member

grouma commented Oct 17, 2022

I'm not sure what client ID you are referring to. I'm pretty sure this has been broken since #1786. I'm not sure why closureForRootDir takes a String protocol parameter.

@jakemac53
Copy link
Contributor

I am probably just misremembering, I hadn't actually looked into this at all I just thought you had added something for multiple apps on the page so we could know which one we were talking to

@jakemac53 jakemac53 added the P3 A lower priority bug or feature request label Oct 20, 2022
@jakemac53
Copy link
Contributor

@jhenso if you want to take a look at fixing this we would accept a PR. Given it has been broken for a long time without any issues being filed, it probably isn't going to be high priority to fix.

@jakemac53 jakemac53 added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Oct 20, 2022
@simolus3
Copy link
Contributor

simolus3 commented Oct 22, 2022

It looks like this is actually a bug in shelf_web_socket, this should be (Never, Never) to test for a binary function. Null is no longer a bottom type, so build_runner's callback of void Function(WebSocketChannel, String) is not a void Function(Null, Null).

https://github.com/dart-lang/shelf/blob/39d820d4e32fc99c65f562786097487d597dcee1/pkgs/shelf_web_socket/lib/shelf_web_socket.dart#L46

Why this surfaces in build_runner and not in shelf_web_socket tests is another question. Do these original tests not run with sound null safety? Maybe this got broken by migrating build_runner to sound null safety?

@jakemac53 jakemac53 added the closed-stale Closed as the issue or PR is assumed stale. label Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-stale Closed as the issue or PR is assumed stale. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants