extism / js-pdk

Write Extism plugins in JavaScript & TypeScript
42 stars 16 forks source link

Plugin compilation warning #18

Closed mattjohnsonpint closed 9 months ago

mattjohnsonpint commented 9 months ago

Hi. I'm trying the example at https://extism.org/docs/write-a-plugin/js-pdk. When I compile the plugin, I get:

warning: unknown name subsection with id 9 at 3197029

This is using version 0.5.0 of the extism-js compiler, on Linux x64. (Ubuntu 22.04 on WSL)

It does produce a wasm file, but that file doesn't work in my Golang host. I get the following when attempting to load the plugin:

module[wasi_snapshot_preview1] not instantiated

However, if I use the precompiled wasm sample files from https://github.com/extism/extism/tree/main/wasm my host works fine.

mattjohnsonpint commented 9 months ago

I figured out that I need to pass EnableWasi: true to extism.PluginConfig when loading in my host. Now it works fine. Still, I'm not sure what causes the warning during compilation or if I need to worry about that.

bhelx commented 9 months ago

warning: unknown name subsection with id 9 at 3197029

This is just a warning saying that the runtime does not recognize a custom section added to the module. This is okay as the custom section is just some extra metadata. It's something happening because of a tool we are using under the hood but should go away soon. Thanks for reporting though!

I figured out that I need to pass EnableWasi: true to extism.PluginConfig when loading in my host.

Good to hear! Yes, js plug-ins need wasi enabled right now unfortunately. However they don't actually need to use the filesystem or network unless your plug-in does.