I'm trying to use <@ffmpeg-wasm> and it needs weba...
# sst
j
I'm trying to use @ffmpeg-wasm and it needs webassembly threads support but it seems it's not enabled by default. I tried to enable it by setting
Copy code
environment: {NODE_OPTIONS: '--experimental-wasm-threads'}
but after adding it the function is just never invoked. it's an api and I am invoking it manually via the sst console. Where am I going wrong? Is this the correct way to enable it? Edit: ah it is trying to invoke, I now see an error
/var/lang/bin/node: --experimental-wasm-threads is not allowed in NODE_OPTIONS
. Is there any way to allow this?
t
hm do you think this is a node version issue?
what version do yo uhave
j
I use the 14.x runtime
On the command line I use node 14.18 and when I run
node --experimental-wasm-threads
I see no error, so not sure why the lambda blocks it
The full definition is
Copy code
const api = new sst.Api(this, 'Api', {
      routes: {
        'GET /test': {
          handler: 'src/services/queues/consumer.handler',
          layers: [this.ffmpegLayer()],
          environment: {
            NODE_OPTIONS: '--experimental-wasm-threads',
          },
          runtime: 'nodejs14.x',
        },
      },
    });
node only complains when I add the environment variable. when i remove it the library complains because it expects wasm thread support
f
@Jason are you getting this error running locally (ie.
sst start
) or after u deployed?
j
@Frank locally, haven't tried deploying
t
can you set
enableLiveDev: false
below
handler
and run sst start
j
@thdxr same error
Copy code
23:18:51.508
[INFO]
/var/lang/bin/node: --experimental-wasm-threads is not allowed in NODE_OPTIONS
23:18:51.508
[ERROR]
Error: Runtime exited with error: exit status 9 Runtime.ExitError
t
So that executed it in aws, not locally which means there must be some versions of node where this isn't supported
j
is there some way i can specify the 'x' in 14.x?
f
No, there isn’t.
@Jason can u try running this locally
Copy code
NODE_OPTIONS=--experimental-wasm-threads node -v
j
@Frank ok so that's interesting, that doesn't work. I get
node: --experimental-wasm-threads is not allowed in NODE_OPTIONS
. but when I run
node --experimental-wasm-threads
it works fine and actually enables the feature
Copy code
node --experimental-wasm-threads
Welcome to Node.js v14.18.2.
Type ".help" for more information.
> const check = require("wasm-check")
undefined
> check.feature.threads
true
when I don't pass the flag the feature is disabled
Copy code
node 
Welcome to Node.js v14.18.2.
Type ".help" for more information.
> const check = require("wasm-check")
undefined
> check.feature.threads
false
>
f
I see. Do you know if there’s a way to pass in
--experimental-wasm-threads
to Lambda function?
j
I was hoping you'd know haha. I have no idea, maybe its impossible. I can't find anything online about how to change the start command for a lambda
May just have to wait for them to support node 16, where this is enabled by default.
f
Haha yeah afaik
NODE_OPTIONS
was the only option