Skip to content

Conversation

@arpadgabor
Copy link

Unfortunately you can't just move dependencies from dev -> prod because the lambda build uses tsc, which does not bundle dependencies. Instead, I used tsup to generate the dist/index.js file required for the lambda. It contains all dependencies, including the used methods from the SDK.

Copy link
Owner

@mooyoul mooyoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left minor note ;)

"clean": "rm -rf dist",
"prebuild": "npm run clean",
"build": "tsc -p tsconfig.json",
"build": "tsup src/index.ts",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current CDK configuration packages everything under dist/ directory to zip archive.
Which means, we just need to have dependencies under dist/ directory, like following way:

  1. move aws-sdk to dep from dev dep
  2. define "postbuild" hook or combine with build hook to copy dependencies
  • e.g."postbuild": "cp package*.json dist/ && cd dist && npm ci && cd .."
  1. that's all. simple, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that, but with tsup it's bundled directly into a single file inside dist/index.jsand it has 944kb, don't think we need the whole aws-sdk.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I know that we can get smaller & standalone js bundle, but I don't prefer bundled script unless we really need it because it makes debugging harder (e.g. locations in stacktrace are also minified - we need to bundle, or inline source map and use sourcemap-support like stuffs to restore original locations), and most importantly, we will be using the AWS SDK (v3) bundled with the lambda runtime again in the next release - we have to revert those changes for bundling in the next release

@mathbunnyru
Copy link

@mooyoul @arpadgabor hi,
Thank you for this project.

As a open-source contributor and maintainer myself, I understand you owe me nothing.
But I still would like to ask you if you could work on this PR.

I am not typescript developer myself (yet), so I can't add value to the project/PR.
It seems that right now there is no way to use this project at all, so it would be nice to have this fixed.

@jayalfredprufrock
Copy link

@mathbunnyru at some point AWS added official CDK support for creating SES identities, see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ses.Identity.html

I'm not positive the official construct does everything this library did, but I didn't find anything missing. If it does have feature parity, perhaps the maintainers here could post a note in the readme and deprecate this package to avoid confusion.

@mathbunnyru
Copy link

Thank you @jayalfredprufrock, I will take a look.

@silberistgold
Copy link

@jayalfredprufrock As far as I know the Identity class in CDK does not support auto verifying domains. Or did that change in the last couple of months?
This means when using CDK Identity we have to manually verify the SES Identity during or after deployment in the aws console or using an additional script, correct?

@jayalfredprufrock
Copy link

@silberistgold In the very beginning it didn't have support, but at some point it was added. I've been using it successfully for 8 months or so. Obviously it did require deleting the existing custom resource and manually removing the verified identities, but once I did that the official package worked just the same as this one and handled the verification process automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants