Page MenuHomeDevCentral

Panic when a site name can't be resolved
Closed, ResolvedPublic

Description

Depending of the configuration, Alkane can panics when you resolve a site name:

  • site_directory_template: "%fqdn%" -> always safe
  • site_directory_template: "%domain%.%tld%/%subdomain%" -> can panic

If a template refers to the domain parts, and you invoke the HTTP API with something not looking like a domain name, like foo (ie something without dot, or only one), the ful server will crash. And it's not Erlang where it's only a process and it doesn't matter, ready for next requests, it's a final crash, game over.

It also panics with the CLI, but that's not an issue, as we can go on anyway, and it provides a correct reason:

/home/dereckson ] alkane deploy foo
thread 'main' panicked at 'Can't get site path.', src/actions.rs:46:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
zsh: abort (core dumped)  alkane deploy foo

Event Timeline

dereckson triaged this task as High priority.Apr 12 2023, 18:28
dereckson created this task.

With the fix:

HTTP request

[2023-04-13T01:19:00Z WARN alkane::server::requests] Can't run deployment action 'init' for site 'foo': Can't resolve site path

CLI

$ ../target/debug/alkane deploy foo
Can't run deployment action 'init' for site 'foo': Can't resolve site path

If it's the only bug we can bump the version.