sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.09k stars 126 forks source link

sst is not support `@node-rs/*` libary #551

Closed gronxb closed 2 weeks ago

gronxb commented 2 weeks ago

i am deploying a Remix app using SST. i am using oslo to incorporate Bcrypt and Argon2id. this packages internally use the @node-rs package. To successfully deploy on AWS Lambda, this packages need to be excluded from the esbuild bundling process, similar to how sharp and pg-native are handled.

Therefore, we need to support @node-rs/*, which is a wasm package.

https://github.com/napi-rs/node-rs

Error

image
paolostyle commented 2 weeks ago

I don't have an opinion on adding it to the built-in list of packages that shouldn't be bundled but you could just do:

    const remix = new sst.aws.Remix('Remix', {
      transform: {
        server: {
          nodejs: {
            install: ['@node-rs/argon2'],
          },
        },
      },
    });

I use @node-rs/argon2 on a lambda function so it's not as nested and I haven't tested the code above but generally this should work.

gronxb commented 2 weeks ago

@paolostyle it's works well. thanks !