fermyon / spin

Spin is the open source developer tool for building and running serverless applications powered by WebAssembly.
https://developer.fermyon.com/spin
Apache License 2.0
5.25k stars 249 forks source link

Component-type version 3 does not match supported version 2 #1693

Open mikkelhegn opened 1 year ago

mikkelhegn commented 1 year ago

In reference to trying and spin up'ing this app: github.com/mikkelhegn/redirect

What's causing this error in Spin?

spin build works fine.

When I do spin up, I see the following error:

sohan@Sohans-MBP redirect % spin up
Logging component stdio to ".spin/logs/"
Storing default key-value data to ".spin/sqlite_key_value.db"
Error: Failed to instantiate component 'api'

Caused by:
    0: decoding custom section component-type:reactor
    1: component-type version 3 does not match supported version 2
Error: exit status: 1

Am I missing something in setup? wasn't able to debug

Originally posted by @sohanmaheshwar in https://github.com/fermyon/developer/issues/779#issuecomment-1677608525

itowlson commented 1 year ago

It loads okay for me. Which version of Spin are you using @sohanmaheshwar?

itowlson commented 1 year ago

Answering my own question: @sohanmaheshwar is on v1.3 or earlier. If I run it with Spin 1.3 I see the exact same error.

This is because @mikkelhegn's app links to SDK 1.4.1. It is expected that 1.4 apps will not run on 1.3, but obviously it would be good to make this error friendlier! I don't know if it's worth backporting that to 1.3 though.

@dicej I thought we added well-known exports or something to enable us to give friendlier messages on SDK/Spin compatibility mismatches - is this failing before we can get to even checking those?

dicej commented 1 year ago

@dicej I thought we added well-known exports or something to enable us to give friendlier messages on SDK/Spin compatibility mismatches - is this failing before we can get to even checking those?

The exports are there (assuming you've used a somewhat recent version of the Rust, Go, JS, or Python SDK), but I don't believe anyone's added code to check them and include them in error messages yet.

rylev commented 1 year ago

This error is at a different layer - we're trying to read the component metadata from a custom section and that fails because the metadata is encoded differently. I'll try to see if I can make this error message better.