-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build Error: Cannot find module '@aws-sdk/client-ses' and 'googleapis' in Lambda function with layers (Amplify Gen 2) #2395
Comments
Hey @mikedorsey1021, thank you for reaching out. This appears to be typescript error on a deploy. The key (module name) is used to externalize the locally installed module dependency so it doesn't get bundled with your lambda function. Once deployed to the cloud the Lambda function will refer to the Lambda layer for your dependencies. |
I did install it locally as you suggested, thank you for that. After doing so, unfortunately it lands me back to an original error which is
|
Hey @mikedorsey1021, the deploy appears to have failed due Are you experiencing this error on a sandbox deploy as well? are there any changes on |
No changes on the |
@mikedorsey1021 noticed additionally, tried reproducing the deploy issue using the following but did not observe an error message
|
I did try updating the packages but was not able to get a different result. Is there anyway I can share the the repo with you? Its private so I'll have to add you. |
@mikedorsey1021 you could provide us a link the repository with a minimal reproduction. |
Environment information
Describe the bug
I'm encountering a persistent build error in my Amplify Gen 2 project when deploying to production via the Amplify console. The build fails with a
TypeScript validation check failed
error, indicating that the modules@aws-sdk/client-ses
andgoogleapis
cannot be found in my Lambda function (sendEmailReceipt
) even though I'm using Lambda layers to provide these dependencies.Error Message (from Amplify Console build log):
SyntaxError: TypeScript validation check failed. Resolution: Fix the syntax and type errors in your backend definition. Cause: amplify/functions/send-email-receipt/handler.ts(2,45): error TS2307: Cannot find module '@aws-sdk/client-ses' or its corresponding type declarations. amplify/functions/send-email-receipt/handler.ts(3,24): error TS2307: Cannot find module 'googleapis' or its corresponding type declarations.
amplify/functions/send-email-receipt/handler.ts
The error occurs both in the Amplify Sandbox and in the production build on the Amplify console.
Expected behavior:
The Amplify build should succeed, and the sendEmailReceipt Lambda function should be able to access the googleapis and @aws-sdk/client-ses modules from the layers during runtime.
Actual behavior:
The build fails with the TypeScript validation check failed error, indicating that the modules cannot be found.
Reproduction steps
Reproduction steps
sendEmailReceipt
.googleapis-layer
: Contains thegoogleapis
npm package.ses-layer
: Contains the@aws-sdk/client-ses
npm package.defineFunction
construct forsendEmailReceipt
.Code Snippets:
amplify/functions/send-email-receipt/resource.ts
:Additional Notes:
I suspect there might be a bug or a specific configuration issue related to how Amplify Gen 2 handles Lambda layers during the production build process. Any help or guidance would be greatly appreciated. It seems it doesn't play nicely with outside dependencies regardless of how you import them and try and use it.
The text was updated successfully, but these errors were encountered: