Hey! So running into a new error - I’ve setup a Cl...
# sst
b
Hey! So running into a new error - I’ve setup a Cloudwatch Rules with a Lambda Target: •
@aws-cdk/aws-events.Rule
for rule •
@serverless-stack/resources.Function
for function •
@aws-cdk/aws-events-targets.LambdaFunction
+ the
rule.addTarget
for targeting the lambda to rule Everything deploys fine, and have an
sst start
running, but my lambda function is throwing error:
Copy code
> node_modules/@serverless-stack/resources/dist/App.js:212:57: warning: "@aws-cdk/aws-s3" should be marked as external for use with "require.resolve"
    212 │                 codeDirectory: path.join(require.resolve("@aws-cdk/aws-s3"), "../auto-delete-objects-handler"),
        ╵                                                          ~~~~~~~~~~~~~~~~~

 > node_modules/fsevents/fsevents.js:13:23: error: No loader is configured for ".node" files: node_modules/fsevents/fsevents.node
    13 │ const Native = require("./fsevents.node");
       ╵                        ~~~~~~~~~~~~~~~~~

8f2f6eb8-04d0-404d-84b6-743959b1267e ERROR build_failure: The function src/cw-ingestor.debugHandler failed to build
Seems like the
sst.Function
build sugars aren’t getting wired up properly when using the
aws-event-targets
package?
Any ideas?
Update: digging into esbuild / https://github.com/evanw/esbuild/issues/1051
fyi, updating sst function’s bundle prop may have resolved issued. 🤷 we’ll see, but for completedness snippet below
Copy code
const debugLambda = new sst.Function(this, 'debugLambda', {
      handler: 'src/cw-ingestor.debugHandler',
      bundle: {
        loader: {
          '.node': 'file',
        },
      },
    })
t
what version was this?
b
I saw this on
0.57.2
and then I upgraded to
0.57.4
saw this issue on both version
t
gotcha I'm confused by the first error - your function code is depending on awsCdk?
Or is it failing to even deploy the stack?
b
deployments work just fine, but when lambda runs - it’s definately a runtime issue
t
your handler depends on aws-cdk? It seems like esbuild is trying to bundle cdk with your function which would only happen if your function imports it
b
my handler IS in the same file as CDK constructs (I was lazy)
good call, let me break it out
@thdxr you got it! makes sense in the end. wasn’t actually related to Sam’s original issue in this thread
and I closed my issue with fix steps 👌