spin: Invalid discriminant for `option`

Hey all, Just tried spin out for the first time and tried to build the hello-rust example and I’m running into the following situation:

Expected Behavior

HTTP/1.1 200 OK
foo: bar
content-length: 15

Hello, Fermyon!

Steps to Reproduce the Problem

  1. Follow installation guide using cargo
  2. Build new project using: spin new http-rust spin-hello-world
  3. Run: spin build --up
  4. Make a request with: curl -i localhost:3000/hello

Actual Behavior

I get a response of:

HTTP/1.1 500 Internal Server Error
content-length: 0

With a log of:

 ERROR spin_http_engine: Error processing request: invalid discriminant for `option`

Specifications

  • Version: 0.3.0
  • Platform: Intel Mac running MacOS 12.4

As I said this is the first time I’ve built spin so not sure where to debug this

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@gmlewis: Please try the following:

cargo uninstall spin-cli
git clone https://github.com/fermyon/spin -b v0.3.0
cd spin
rustup target add wasm32-wasi
cargo install --path .
spin templates install --git https://github.com/fermyon/spin --branch v0.3.0 --update
spin new http-rust spin-hello-world
cd spin-hello-world
spin build
spin up

That should ensure you have the correct Spin version and compatible templates. Then, in another terminal:

curl http://127.0.0.1:3000

Probably the best approach here is to use the latest release rather than the HEAD of the Git repo, e.g. git checkout v0.3.0. I’m going to open a PR shortly to change the quickstart instructions to use the tag. I’ll also open a new issue for adding an explicit version check to the SDK so we can provide an informative error in cases like this.