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

[Shock][CLI] - Support offline mode #128

Open
suragch opened this issue May 25, 2024 · 1 comment
Open

[Shock][CLI] - Support offline mode #128

suragch opened this issue May 25, 2024 · 1 comment

Comments

@suragch
Copy link
Collaborator

suragch commented May 25, 2024

Static Shock allows users to serve and update the content dynamically during development using the shock serve CLI command. However, it only works when there is an internet connection. This makes it inconvenient to continue development on a flight or other occasions when internet connectivity is unavailable.

Reproduction steps:

  1. Generate a new Static Shock project.
  2. Disconnect from the internet.
  3. Run shock serve.

Expected result:

The server runs locally and serves the site content at http://localhost:4000/.

Actual result:

An unhandled ClientException is thrown.

The following is the full error message and stack trace:

Unhandled exception:
ClientException with SocketException: Failed host lookup: 'pub.dev' (OS Error: nodename nor servname provided, or not known, errno = 8), uri=https://pub.dev/api/packages/static_shock_cli
#0      IOClient.send (package:http/src/io_client.dart:154:7) <asynchronous suspension>
#1      BaseClient._sendUnstreamed (package:http/src/base_client.dart:93:32) <asynchronous suspension>
#2      _withClient (package:http/http.dart:167:12) <asynchronous suspension>
#3      PubUpdater._getPackageInfo (package:pub_updater/src/pub_updater.dart:87:22) <asynchronous suspension>
#4      PubUpdater.getLatestVersion (package:pub_updater/src/pub_updater.dart:57:25) <asynchronous suspension>
#5      StaticShockCliVersion.isAtLeastUpToDateWithPub (package:static_shock_cli/src/version_check.dart:42:27) <asynchronous suspension>
#6      PubVersionCheck.run (package:static_shock_cli/src/version_check.dart:23:24) <asynchronous suspension>
#7      ServeCommand.run (package:static_shock_cli/src/commands/serve_command.dart:45:5) <asynchronous suspension>
#8      CommandRunner.runCommand (package:args/command_runner.dart:212:13) <asynchronous suspension>
#9      main (file:///Users/suragch/.pub-cache/hosted/pub.dev/static_shock_cli-0.0.7/bin/static_shock_cli.dart:26:5) <asynchronous suspension>

Resolving ambiguities

It is unclear at this point if the issue is related to SS itself or Dart. If something about running the Dart server requires contacting pub.dev, then the expected result would be to gracefully handle the exception and inform the user that shock serve only works with an internet connection.

shock build does not throw an exception when there is no internet connection.

@suragch suragch changed the title Unhandled exception when no internet connection ClientException exception thrown on shock serve with no internet connection May 29, 2024
@suragch
Copy link
Collaborator Author

suragch commented May 29, 2024

@matthew-carroll Updated this issue in accordance with the following:

@matthew-carroll matthew-carroll changed the title ClientException exception thrown on shock serve with no internet connection [Shock][CLI] - Support offline mode Jun 7, 2024
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

1 participant