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

Diagnostic for running Wagi component under Spin executor #351

Merged
merged 1 commit into from
Apr 13, 2022

Conversation

itowlson
Copy link
Contributor

If you accidentally forget the executor line on a Wagi component, you get the enigmatic error "failed to find function export canonical_abi_free". This has happened to several of us cough cough - for some of us cough more than once cough cough cough.

This PR provides an additional diagnostic around the error message - a user viewing the logs at the default level will now see:

09:55 $ spin up 
Serving HTTP on address http://127.0.0.1:3000
2022-04-13T21:55:09.687838Z ERROR spin_http_engine: Error processing request: component is not compatible with Spin executor - should this use the Wagi executor?

Caused by:
    failed to find function export `canonical_abi_free`

Very open to improving the message, or to detecting the condition in a less hideous way!

Copy link
Member

@radu-matei radu-matei left a comment

Choose a reason for hiding this comment

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

Unless we start returning specific errors (as opposed to anyhow::Errors, which we should explore at some point), I don't see a prettier way to check for this error, so this LGTM.

@itowlson itowlson merged commit 151d126 into fermyon:main Apr 13, 2022
@@ -190,6 +192,18 @@ impl SpinHttpExecutor {
}
}

fn contextualise_err(e: anyhow::Error) -> anyhow::Error {
if e.to_string()
.contains("failed to find function export `canonical_abi_free`")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Gross! 👍

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

Successfully merging this pull request may close these issues.

3 participants