How to resolve issues with Shopify Functions App tutorial?

Hi. I’ve been following the ‘Build a discount experience’ tutorial but have hit a few early issues:

  1. When installing cargo-wasi, I get the warning:

warning: be sure to add [...] to your PATH to be able to run the installed binaries

I think I’ve done that but I thought it was worth mentioning, in case it’s related to the problems below.

  1. If I try using Javascript as the language the typegen function doesn’t work, with terminal reporting:

Missing script: “typegen”

  1. If I proceed instead in Rust, when I get to the deploy step (1.8) it fails:

── external error

Error coming from cargo wasi build --release

Command failed with exit code 101: cargo wasi build --release
Compiling product-discount v1.0.0 ([…]**)
error: expected item, found import
→ src/main.rs:2:1
|
2 | import { DiscountApplicationStrategy } from “../generated/api”;
| ^^^^^^ expected item

error: could not compile product-discount due to previous error

Any help or direction on the above would be greatly appreciated. (I have previously done the ‘Create an app’ tutotial (https://shopify.dev/docs/apps/getting-started/create) without any of the above issues.)

Thanks in advance.

Thanks so much for your detailed input on this.

I double-checked my PATH settings and could see that cargo-wasi was included with the correct location. I then started a fresh install of a new app (using javascript) and so far everything is working correctly! Not exactly sure what has changed and interestingly, typegen is still not included in the package.json file — but terminal didn’t throw up any errors when I ran “npm run typegen”.

Thanks again — I’ll now carry on working through the tutorial.