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

[offline] Allow devbox to work offline if DNS fails #1985

Merged
merged 2 commits into from Apr 11, 2024

Conversation

mikeland73
Copy link
Contributor

Summary

Fixes #1977

(with another hack).

Unfortunately the way we structure our flake makes it really difficult to remove our network requests (when state is stale). Ideally, the flake can be built off of local only nix store references, but that's a much bigger project.

In the meantime, this is a quick hack that fixes issue above.

How was it tested?

Added synthetic error that returns connection refused in the message. Ensures I was still able to run/shell with a stale state.

ux.Fwarning(
d.stderr,
"Error connecting to the internet. Will attempt to use cached environment.\n",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does the user experience if there was no cached environment?

i.e. can you rm -rf .devbox, turn off internet and see what you experience?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fails with an ugly error. I just added a check so we only keep going if the print dev env cache is there.

There are still a few other edge case failure modes, e.g. if some package has been gc'd from nix store, but I think that's fine.

@mikeland73 mikeland73 merged commit 6aca4d4 into main Apr 11, 2024
24 checks passed
@mikeland73 mikeland73 deleted the landau/offline-fix branch April 11, 2024 00:58
Copy link

sentry-io bot commented Apr 12, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ *exec.ExitError: nix print-dev-env --json "path:": <redacted exec.ExitError> go.jetpack.io/devbox/internal/nix in (*Nix).Pri... View Issue
  • ‼️ Generic Error: error running script in Devbox: GET https://search.devbox.sh/v2/resolve?name=go... go.jetpack.io/devbox/internal/searcher in execG... View Issue
  • ‼️ **syscall.Errno: <redacted errors.withStack>: <redacted fs.PathError>: go.jetpack.io/devbox/internal/cuecfg in ParseFi... View Issue
  • ‼️ **syscall.Errno: <redacted *errors.withStack>: <redacted errors.withStack>: <redacted errors.withStack>: <redact... go.jetpack.io/devbox/internal/shellgen in creat... View Issue

Did you find this useful? React with a 👍 or 👎

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

Successfully merging this pull request may close these issues.

Unable to activate a shell because of a network error. I am unable to work.
2 participants