sst / ion

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

fix(node): support `@node-rs/*` package #550

Closed gronxb closed 2 weeks ago

gronxb commented 2 weeks ago

Problem

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.

If the following Pull Request is merged, it may cause a conflict: #549. If the above PR and current PR are merged, we can achieve a successful deployment.

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

image

Closed #551

gronxb commented 2 weeks ago

this code can resolve the issue.

--- a/sst.config.ts
+++ b/sst.config.ts
@@ -17,6 +17,9 @@ export default $config({
                new sst.aws.Remix("CuratorClip", {
                        transform: {
                                server: {
+                                       nodejs: {
+                                               install: ["@node-rs/argon2", "@node-rs/bcrypt"],
+                                       },
                                },
                        },