Closed MikeTeddyOmondi closed 1 week ago
Hi @MikeTeddyOmondi , The Spin host functions are only available inside the handler function (handleRequest
). The error you run into is because we use wizer to pre-initialize the wasm module and that does not use the spin runtime.
You would also want to use configs inside the function because anything outside will essentially be run only once during build time. Let me know if I can help further.
@karthik2804 That's true... I had to move the router and its handlers to the main function for it to compile safely....
I am marking this as completed, if there are any. issues please feel free to reopen the issue.
I encountered an error while building an application with Spin when trying to use the
Config
import from the spin SDK (@fermyon/spin-sdk
)Environment
Linux - Ubuntu 22.04 Spin version - 2.1.0 (f33bb63 2023-12-14)
Source Code
I used the
spin-http-ts
template to generate the projectspin.toml
package.json
index.ts - pulled from this example
Unexpected Behaviour:
The applications builds when the import is removed
Expected Behaviour
I expected to use the
Config
import to import secrets defined in the spin.toml file