aws-samples / aws-sdk-js-notes-app

A simple note taking application using modular AWS SDK for JavaScript (v3)
Other
81 stars 30 forks source link

[WIP] feat(infra): use @aws-cdk/aws-lambda-nodejs for deploying lambda functions #41

Closed trivikr closed 5 months ago

trivikr commented 3 years ago

Issue

Fixes: https://github.com/aws-samples/aws-sdk-js-notes-app/issues/5

Description

Uses @aws-cdk/aws-lambda-nodejs for deploying lambda functions

Testing

Local testing fails with the following error:

Error ```console Bundling asset aws-sdk-js-notes-app/listNotes/handler/Code/Stage... Usage Error: Couldn't find a script named "esbuild". $ yarn run [--inspect] [--inspect-brk] ... Failed to bundle asset aws-sdk-js-notes-app/listNotes/handler/Code/Stage, bundle output is located at /Users/trivikr/workspace/aws-sdk-js-notes-app/packages/infra/cdk.out/bundling-temp-5bb75d211320cf28d3cf5adb03a9d0bb9c0e0da9a537186ee43b0a7cf9817345-error: Error: bash exited with status 1 /Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/@aws-cdk/core/lib/private/synthesis.ts:213 throw new Error(`Validation failed with the following errors:\n ${errorList}`); ^ Error: Validation failed with the following errors: [aws-sdk-js-notes-app/endpoint] The REST API doesn't contain any methods at validateTree (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/@aws-cdk/core/lib/private/synthesis.ts:213:11) at Object.synthesize (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/@aws-cdk/core/lib/private/synthesis.ts:28:5) at App.synth (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/@aws-cdk/core/lib/stage.ts:94:23) at process. (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/@aws-cdk/core/lib/app.ts:64:45) at Object.onceWrapper (events.js:482:26) at process.emit (events.js:375:28) at process.emit (domain.js:470:12) at process.emit (/Users/trivikr/.npm/_npx/84297/lib/node_modules/ts-node/node_modules/source-map-support/source-map-support.js:495:21) Subprocess exited with error 1 ```

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

trivikr commented 3 years ago

The error is likely with yarn workspaces setup. I was not able to reproduce it with CDK Getting Started App in https://github.com/trivikr/aws-cdk-no-methods-error

trivikr commented 3 years ago

As of now, we're using esbuild separately for bundling in https://github.com/aws-samples/aws-sdk-js-notes-app/pull/40

trivikr commented 5 months ago

Replaced by https://github.com/aws-samples/aws-sdk-js-notes-app/pull/122