Coder Social home page Coder Social logo

ps-serverless-app's Introduction

Serverless Development on AWS

Learning Path on Pluralsight

This repository is for the Serverless Development on AWS learning path for Pluralsight.

Approach

This learning path is focused on creating a modern full-stack serverless application on AWS using real world techniques and approaches. It follows the following opinionated concepts:

  • It leverages a monorepo structure with Yarn workspaces
  • The backend services are created for Node.js with JavaScript and are exposed as REST API's
  • The web application is created using React using hooks
  • The infrastructure is defined with TypeScript using the AWS CDK
  • Continuous delivery is implemented using an AWS CDK Pipeline
  • No third-party services are leveraged as the focus is on a cloud-native approach with AWS only

Following Along

This repository is designed to be used alongside the learning path. While the course consists of 11 courses, there are 5 courses where the concepts are applied to the sample application. For each of these courses, you will have a starting and ending branch. In addition, there will be a link to compare those two branches.

Implementing Serverless Web Application Hosting and Delivery on AWS

Learn about leveraging Amazon S3 and CloudFront to distribute serverless web applications on a global scale.

Course Link

Building a Serverless API Tier with Amazon API Gateway

Learn about using AWS Lambda as your compute service while exposing an API with API Gateway all while using Amazon DynamoDB to store application data.

Course Link

Utilizing Amazon EventBridge in Serverless Applications

Learn about using Amazon EventBridge alongside Amazon S3 and Step Functions to create powerful microservices for your serverless application.

Course Link

Implementing Authentication for a Serverless HTTP API on AWS

Learn about securing serverless applications with Amazon Cognito for both web applications and the API tier.

Course Link

Implementing Monitoring and Continuous Deployment for Serverless Applications on AWS

Learn about monitoring your serverless applications with Amazon CloudWatch and AWS X-Ray as well as creating custom operational dashboards and alarms.

Course Link

ps-serverless-app's People

Contributors

bl-ue avatar davidtucker avatar jamesadcock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ps-serverless-app's Issues

ERR_OSSL_EVP_UNSUPPORTED while attempting P1 npx idk deploy

I have been following this course with no issue using PyCharm pro as my IDE, so do not believe that is the issue but have just run into an error that does not appear to have a clear resolution.

I was able to successfully deploy the application earlier in the P1 course section prior to adding this section in webapp.ts:

// Deploy Web App ---------------------------------------------------------

    new cwt.WebAppDeployment(this, 'WebAppDeploy', {
        baseDirectory: props.baseDirectory,
        relativeWebAppPath: props.relativeWebAppPath,
        webDistribution: this.webDistribution,
        webDistributionPaths: ['/*'],
        buildCommand: 'yarn build',
        buildDirectory: 'build',
        bucket: props.hostingBucket,
        prune:true
    });

    new cdk.CfnOutput(this, 'URL', {
        value: `https://${this.webDistribution.distributionDomainName}/`
    });`

After adding this (and the related entries in index.ts):
baseDirectory: '../', relativeWebAppPath: 'webapp', });

I am now receiving the following error when attempting to run npx cdk deploy:

[my user]@MacBook-Pro: ~/PycharmProjects/ps-serverless-app/infrastructure p1! $ npx cdk deploy [12:19:19] Bundling asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage... yarn run v1.22.15 warning Skipping preferred cache folder "/.cache/yarn" because it is not writable. warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-501". $ react-scripts build warning Cannot find a suitable global folder. Tried these: "/usr/local, /.yarn" Creating an optimized production build... Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at module.exports (/asset-input/node_modules/webpack/lib/util/createHash.js:135:53) at NormalModule._initBuildHash (/asset-input/node_modules/webpack/lib/NormalModule.js:417:16) at handleParseError (/asset-input/node_modules/webpack/lib/NormalModule.js:471:10) at /asset-input/node_modules/webpack/lib/NormalModule.js:503:5 at /asset-input/node_modules/webpack/lib/NormalModule.js:358:12 at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:373:3 at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:214:10) at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:221:10) at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:236:3 at runSyncOrAsync (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:130:11) at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:232:2) at Array.<anonymous> (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:205:4) at Storage.finished (/asset-input/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16) at /asset-input/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9 /asset-input/node_modules/react-scripts/scripts/build.js:19 throw err; ^ Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at module.exports (/asset-input/node_modules/webpack/lib/util/createHash.js:135:53) at NormalModule._initBuildHash (/asset-input/node_modules/webpack/lib/NormalModule.js:417:16) at /asset-input/node_modules/webpack/lib/NormalModule.js:452:10 at /asset-input/node_modules/webpack/lib/NormalModule.js:323:13 at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:367:11 at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:233:18 at context.callback (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:111:13) at /asset-input/node_modules/react-scripts/node_modules/babel-loader/lib/index.js:59:103 { opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' } Node.js v17.0.1 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Failed to bundle asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage, bundle output is located at /Users/[my user]/PycharmProjects/ps-serverless-app/infrastructure/cdk.out/asset.8c7ae86f7dabf723a79310f22f328c471bdaec37da5325cd834784dc03a40eff-error: Error: docker exited with status 1 Subprocess exited with error 1 FAIL

It appears that this might be a Yarn issue, but following these instructions and adding
"start": "react-scripts --openssl-legacy-provider start", "build": "react-scripts --openssl-legacy-provider build",

to my package.json file does not resolve or change the output in any way.

Any input would be most appreciated! I'm hoping I've missed something obvious here.

Summary of tools setup/install in Readme file

The node, npm, yarn and CDK setup is described within the course material, but apart from the tuck.cc links, is not readily seen at this level, if you want to spin up a build from scratch without following the course (again!).

A paragraph at the Readme end, just summarising the tools setup commands would be very useful.

Error on npx cdk deploy

Following error thrown. Running the command after checkout to p2 branch

npx cdk deploy
Bundling asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage...
yarn run v1.22.15
warning Skipping preferred cache folder "/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-501".
$ react-scripts build
warning Cannot find a suitable global folder. Tried these: "/usr/local, /.yarn"
Creating an optimized production build...
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (/asset-input/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/asset-input/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/asset-input/node_modules/webpack/lib/NormalModule.js:471:10)
at /asset-input/node_modules/webpack/lib/NormalModule.js:503:5
at /asset-input/node_modules/webpack/lib/NormalModule.js:358:12
at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at runSyncOrAsync (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
at Array. (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/asset-input/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at /asset-input/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
/asset-input/node_modules/react-scripts/scripts/build.js:19
throw err;
^

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (/asset-input/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/asset-input/node_modules/webpack/lib/NormalModule.js:417:16)
at /asset-input/node_modules/webpack/lib/NormalModule.js:452:10
at /asset-input/node_modules/webpack/lib/NormalModule.js:323:13
at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /asset-input/node_modules/react-scripts/node_modules/babel-loader/lib/index.js:59:103 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v17.2.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

/Users/kasunrajapakse/Desktop/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:472
for (const key of Object.keys(object).sort()) {
^
Error: Failed to bundle asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage, bundle output is located at /Users/kasunrajapakse/Desktop/ps-serverless-app/infrastructure/cdk.out/asset.57fe83670650746cd594a8c1c7be0ff34d1f750120c2e51d7b80021d08f81928-error: Error: docker exited with status 1
at AssetStaging.bundle (/Users/kasunrajapakse/Desktop/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:472:13)
at AssetStaging.stageByBundling (/Users/kasunrajapakse/Desktop/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:330:10)
at stageThisAsset (/Users/kasunrajapakse/Desktop/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:196:35)
at Cache.obtain (/Users/kasunrajapakse/Desktop/ps-serverless-app/node_modules/@aws-cdk/core/lib/private/cache.ts:24:13)
at new AssetStaging (/Users/kasunrajapakse/Desktop/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:221:44)
at new Asset (/Users/kasunrajapakse/Desktop/ps-serverless-app/node_modules/@aws-cdk/aws-s3-assets/lib/asset.ts:127:21)
at Object.bind (/Users/kasunrajapakse/Desktop/ps-serverless-app/node_modules/@aws-cdk/aws-s3-deployment/lib/source.ts:89:23)
at /Users/kasunrajapakse/Desktop/ps-serverless-app/node_modules/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts:213:83
at Array.map ()
at new BucketDeployment (/Users/kasunrajapakse/Desktop/ps-serverless-app/node_modules/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts:213:51)
Subprocess exited with error 1

List of tuck.cc links anywhere

Does anyone have a listing of all the links shared in the course or could one be added to the readme here?

This would be very helpful.

EACCES Permissions issue on initial deploy.

When I am setting up the project for the initial deploy I have the following permissions issue.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!                                                                                  !!
!!  This software has not been tested with node v21.5.0.                            !!
!!  You may to encounter runtime issues, and should switch to a supported release.  !!
!!                                                                                  !!
!!  This software is currently running on node v21.5.0.                             !!
!!  As of the current release of this software, supported node releases are:        !!
!!  - ^18.0.0 (Planned end-of-life: 2025-04-30)                                     !!
!!                                                                                  !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Bundling asset PipelineStack/Staging/AppStack/Services/CommentServiceLambda/Code/Stage...
yarn run v1.22.21                                                                                                                                                                                                               
$ /home/lrobbins/learning/aws/ps-serverless-app/node_modules/.bin/esbuild --bundle /home/lrobbins/learning/aws/ps-serverless-app/services/comments/index.js --target=node14 --platform=node --outfile=/home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/bundling-temp-b5b29595a8aa9af3ef00b61b31a4dbb0c65d33fbc552af7d13b6bb2e07e68180/index.js --external:aws-sdk

  infrastructure/cdk.out/bundling-temp-b5b29595a8aa9af3ef00b61b31a4dbb0c65d33fbc552af7d13b6bb2e07e68180/index.js  1.2mb ⚠️

Done in 0.08s.                                                                                                                                                                                                                  
Bundling asset PipelineStack/Staging/AppStack/Services/DocumentServiceLambda/Code/Stage...
yarn run v1.22.21                                                                                                                                                                                                               
$ /home/lrobbins/learning/aws/ps-serverless-app/node_modules/.bin/esbuild --bundle /home/lrobbins/learning/aws/ps-serverless-app/services/documents/index.js --target=node14 --platform=node --outfile=/home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/bundling-temp-988c5588f96ab3985d70d449ca4bbdeaf603209c25d6601d27a6faa244fbb96d/index.js --external:aws-sdk

  infrastructure/cdk.out/bundling-temp-988c5588f96ab3985d70d449ca4bbdeaf603209c25d6601d27a6faa244fbb96d/index.js  1.2mb ⚠️

Done in 0.08s.                                                                                                                                                                                                                  
Bundling asset PipelineStack/Staging/AppStack/Services/NotificationsServiceLambda/Code/Stage...
yarn run v1.22.21                                                                                                                                                                                                               
$ /home/lrobbins/learning/aws/ps-serverless-app/node_modules/.bin/esbuild --bundle /home/lrobbins/learning/aws/ps-serverless-app/services/notifications/index.js --target=node14 --platform=node --outfile=/home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/bundling-temp-0660abad9adab5b2b332d353345b681731f7d8b1b34aba92dc6e770ed2f1a9b2/index.js --external:aws-sdk

  infrastructure/cdk.out/bundling-temp-0660abad9adab5b2b332d353345b681731f7d8b1b34aba92dc6e770ed2f1a9b2/index.js  234.6kb

Done in 0.06s.                                                                                                                                                                                                                  
Bundling asset PipelineStack/Staging/AppStack/Services/UsersServiceLambda/Code/Stage...
yarn run v1.22.21                                                                                                                                                                                                               
$ /home/lrobbins/learning/aws/ps-serverless-app/node_modules/.bin/esbuild --bundle /home/lrobbins/learning/aws/ps-serverless-app/services/users/index.js --target=node14 --platform=node --outfile=/home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/bundling-temp-c10224bd731d43579cda3eee29a8043a1273ee0e681fe5c1023c32ba95dc4bba/index.js --external:aws-sdk

  infrastructure/cdk.out/bundling-temp-c10224bd731d43579cda3eee29a8043a1273ee0e681fe5c1023c32ba95dc4bba/index.js  1.2mb ⚠️

Done in 0.08s.                                                                                                                                                                                                                  
Bundling asset PipelineStack/Staging/AppStack/Processing/MetadataLambda/Code/Stage...
yarn run v1.22.21                                                                                                                                                                                                               
$ /home/lrobbins/learning/aws/ps-serverless-app/node_modules/.bin/esbuild --bundle /home/lrobbins/learning/aws/ps-serverless-app/services/processing/metadata.js --target=node14 --platform=node --outfile=/home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/bundling-temp-abb45db823a148994734a06213af6fd329f1ae1c599898e88fa1aa58339b426a/index.js --external:aws-sdk

  infrastructure/cdk.out/bundling-temp-abb45db823a148994734a06213af6fd329f1ae1c599898e88fa1aa58339b426a/index.js  1.2mb ⚠️

Done in 0.08s.                                                                                                                                                                                                                  
Bundling asset PipelineStack/Staging/AppStack/Processing/ThumbnailLambda/Code/Stage...
yarn run v1.22.21                                                                                                                                                                                                               
$ /home/lrobbins/learning/aws/ps-serverless-app/node_modules/.bin/esbuild --bundle /home/lrobbins/learning/aws/ps-serverless-app/services/processing/thumbnail.js --target=node14 --platform=node --outfile=/home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/bundling-temp-cc97164bc35a741ca31623832ab8f76f7858140a25dec810073683d3125a8a04/index.js --external:aws-sdk

  infrastructure/cdk.out/bundling-temp-cc97164bc35a741ca31623832ab8f76f7858140a25dec810073683d3125a8a04/index.js  234.5kb

Done in 0.06s.                                                                                                                                                                                                                  
Bundling asset PipelineStack/Staging/AppStack/Processing/StartTextDetectionLambda/Code/Stage...
yarn run v1.22.21                                                                                                                                                                                                               
$ /home/lrobbins/learning/aws/ps-serverless-app/node_modules/.bin/esbuild --bundle /home/lrobbins/learning/aws/ps-serverless-app/services/processing/startTextDetection.js --target=node14 --platform=node --outfile=/home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/bundling-temp-3259f49b7e46b23bcc9022fdfa6c13fb8e2f69a32225996bf3cf59eadff89c29/index.js --external:aws-sdk

  infrastructure/cdk.out/bundling-temp-3259f49b7e46b23bcc9022fdfa6c13fb8e2f69a32225996bf3cf59eadff89c29/index.js  233.4kb

Done in 0.06s.                                                                                                                                                                                                                  
Bundling asset PipelineStack/Staging/AppStack/Processing/GetTextDetectionLambda/Code/Stage...
yarn run v1.22.21                                                                                                                                                                                                               
$ /home/lrobbins/learning/aws/ps-serverless-app/node_modules/.bin/esbuild --bundle /home/lrobbins/learning/aws/ps-serverless-app/services/processing/parseTextDetectionResults.js --target=node14 --platform=node --outfile=/home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/bundling-temp-10eccbb126045bc8041886fdea4be6037de8b75ac3d8c105cd9f99bae25a8251/index.js --external:aws-sdk

  infrastructure/cdk.out/bundling-temp-10eccbb126045bc8041886fdea4be6037de8b75ac3d8c105cd9f99bae25a8251/index.js  234.4kb

Done in 0.06s.                                                                                                                                                                                                                  
Bundling asset PipelineStack/Staging/AppStack/Processing/InsertDocumentLambda/Code/Stage...
yarn run v1.22.21                                                                                                                                                                                                               
$ /home/lrobbins/learning/aws/ps-serverless-app/node_modules/.bin/esbuild --bundle /home/lrobbins/learning/aws/ps-serverless-app/services/processing/insert.js --target=node14 --platform=node --outfile=/home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/bundling-temp-c5c21402a1ef081215907e6b617de350eca812f91bd5c0220cc63d2e1fcd0201/index.js --external:aws-sdk

  infrastructure/cdk.out/bundling-temp-c5c21402a1ef081215907e6b617de350eca812f91bd5c0220cc63d2e1fcd0201/index.js  234.9kb

Done in 0.06s.                                                                                                                                                                                                                  
Bundling asset PipelineStack/Staging/AppStack/Processing/CatchErrorLambda/Code/Stage...
yarn run v1.22.21                                                                                                                                                                                                               
$ /home/lrobbins/learning/aws/ps-serverless-app/node_modules/.bin/esbuild --bundle /home/lrobbins/learning/aws/ps-serverless-app/services/processing/catchError.js --target=node14 --platform=node --outfile=/home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/bundling-temp-2170c8861192739c157584034c82ae1f19f9793ce6e3b48882dea1ec7eb76b19/index.js --external:aws-sdk

  infrastructure/cdk.out/bundling-temp-2170c8861192739c157584034c82ae1f19f9793ce6e3b48882dea1ec7eb76b19/index.js  234.5kb

Done in 0.06s.                                                                                                                                                                                                                  
Bundling asset PipelineStack/Staging/AppStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage...
yarn run v1.22.19
$ react-scripts build
Failed to compile.

EACCES: permission denied, mkdir '/asset-input/webapp/build'


info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.

/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:478
      throw new Error(`Failed to bundle asset ${this.node.path}, bundle output is located at ${bundleErrorDir}: ${err}`);
            ^
Error: Failed to bundle asset PipelineStack/Staging/AppStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage, bundle output is located at /home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/asset.74eb0dbe5baf968177f119dbcfa649fdc697034d6aa8e0e2b810c76d0c7caf59-error: Error: docker exited with status 1
    at AssetStaging.bundle (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:478:13)
    at AssetStaging.stageByBundling (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:326:10)
    at stageThisAsset (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:192:35)
    at Cache.obtain (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/private/cache.ts:24:13)
    at new AssetStaging (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:217:44)
    at new Asset (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/aws-s3-assets/lib/asset.ts:134:21)
    at Object.bind (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/aws-s3-deployment/lib/source.ts:108:23)
    at /home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts:327:83
    at Array.map (<anonymous>)
    at new BucketDeployment (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts:327:51)

NOTICES

25356	(pipelines) CDK Pipelines role has overly permissive trust policy

	Overview: A Role that is intended to be used only by the Pipeline can
	          be assumed from other Roles in the same account.

	Affected versions: aws-cdk-lib.pipelines.CodePipeline: >=2.26.0 <2.77.0, @aws-cdk/pipelines.CodePipeline: >=1.158.0 <1.200.0

	More information at: https://github.com/aws/aws-cdk/issues/25356```

Some issues encountered: Tools and runtime error

npm -v: 9.5.1
npx -v: 9.5.1
yarn -v: 1.22.19
and eventually,
cdk --version: 2.79.1 (build 2e7f8b7)

I am guessing that these are down to the vagaries of Node dependencies, not any shortcoming in the demo code itself :-D

  1. To install CDK, requires sudo npm install -g aws-cdk - not the command shown in the course (which fails).
    And just npx cdk bootstrap aws://<account>/<region>
  2. The first run of yarn brings up a list of warnings, which are not present on a second run. Maybe the "fixes" contribute to 3 ?
  3. To successfully run the web app (yarn start) from p1 to p2, requires:
    export NODE_OPTIONS=--openssl-legacy-provider
    due to error:03000086:digital envelope routines
  4. From p3 onwards, run-time error on yarn start(TypeError: Cannot read properties of undefined (reading 'apiEndpoint')) caused by
    webapp/src/services/index.js: const SERVICES_HOST = window.appConfig.apiEndpoint
    OK: Got it - the appconfig tools require the value from a deployment bucket, which is not present in a "yarn start" environment. Hence it maybe could detect it's running in that environment.

Suggestion: Check for required installed apps etc, issue newbie-friendly message

The Pluralsight course is very clear, however it's possible to get so far then have problems with missing installed programs, but for which the error message is unclear and unhelpful in getting things sorted.

eg Error: spawnSync docker ENOENT

Might be useful to have a module that just checks that eg Docker etc is installed and tells you if not. A "pre-flight check".

Yarn install issue on Windows 10

Hi,
I got the code from the p1 branch.
When running yarn in the root folder I get the following error:
error An unexpected error occurred: "EISDIR: illegal operation on a directory, symlink 'E:\WORK\AWS\ps-serverless-app\infrastructure' -> 'E:\WORK\AWS\ps-serverless-app\node_modules\@ps-serverless\infrastructure'".

In the root folder there is a node_modules@ps-serverless folder but it is empty; other node modules are there.
I guess something is wrong when it tries to link to the infrastructure folder, but I cannot figure out what.

I am running the yarn command from the command prompt launched as admin in windows 10 64bit.
Yarn 1.22.17, npm 8.1.0, nodejs v17.0.0.

Thank you,
Razvan

npx cdk deploy error

Hello,
I am getting this error on p1 while trying to utilize @cdk-webapp-tools for cdk construct.

Bundling asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage...
docker: error during connect: This error may indicate that the docker daemon is not running.: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/create": open //./pipe/docker_engine: The system cannot find the file specified.
See 'docker run --help'.
**Failed to bundle asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage, bundle output is located at C:\ReactApp\ps-serverless-app-**p1\infrastructure\cdk.out\asset.771d2d7f452140bc9bf28eafbc13fe5ced81f23acd2fbe17b238c1d840a5fb50-error: Error: docker exited with status 127
Subprocess exited with error 1

I guess i have to install the dependency but dont know how to do that

Unable to bootstrap CDK [p1]

Hi David,
Thanks for making this amazing tutorial, I am facing this unusual issue of --cloudformation-execution-policies can only be passed for the modern bootstrap experience., Kindly help with this, and also if you can help with the npx command explanation.

Unable to deploy - npx cdk deploy

Resource handler returned message: "The runtime parameter of python3.6 is no longer supported for creating or updating AWS Lambda functions. We recommend you u
se the new runtime (python3.9) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 6e070690-e0a8-43eb-bb26-419bced59b2b)" (Re
questToken: 64b577d6-fa91-752c-9334-66f3f0a6bc5f, HandlerErrorCode: InvalidRequest)

TypeError: Cannot read properties of undefined (reading 'apiEndpoint')

Hi Dave,

first of all a big Thank You for your work !!! best in class!!!

Trying to start the webapp (on "Implementing Serverless Web Application Hosting and Delivery on AWS") on the p1 branch, I get:

Module.<anonymous>
src/services/index.js:5
  2 | import createAuthRefreshInterceptor from 'axios-auth-refresh';
  3 | import { Auth } from 'aws-amplify';
  4 | 
> 5 | const SERVICES_HOST = window.appConfig.apiEndpoint;
  6 | let client;
  7 | 
  8 | /* eslint-disable no-console */
View compiled
./src/services/index.js
http://localhost:3000/static/js/main.chunk.js:3459:30
__webpack_require__
/home/trxrse/projects/ps-serverless-app/webapp/webpack/bootstrap:856
  853 | 
  854 | __webpack_require__.$Refresh$.init();
  855 | try {
> 856 | 	modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  857 | } finally {
  858 | 	__webpack_require__.$Refresh$.cleanup(moduleId);
  859 | }

Any idea?

Thanks
Remus

Can't build ``webapp`` on branch ``p2``

I'm working on the course "Building a Serverless API Tier with Amazon API Gateway", and when trying to build at the end of the first module, I'm running into an eslint error:

webapp [p2●] % yarn build
yarn run v1.22.17
$ react-scripts build
Creating an optimized production build...
Failed to compile.

src/components/UserBadge.jsx
  Line 90:68:  JSX props should not use functions  react/jsx-no-bind

Search for the keywords to learn more about each error.


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I started at branch p2 and did not modify the UserBadge.jsx file.
After adding "react/jsx-no-bind": "off" to the eslintConfig/rules section in the webapp/package.json, I got it to build without errors. I am using node v16.13.1 locally, and the node:lts docker image for the build.

The package.json (for reference):

{
  "name": "@ps-serverless/webapp",
  "version": "0.1.0",
  "private": true,
  "main": "build/index.js",
  "dependencies": {
    "@aws-amplify/ui-components": "^1.2.0",
    "@aws-amplify/ui-react": "^1.0.6",
    "@material-ui/core": "^4.11.3",
    "@material-ui/data-grid": "^4.0.0-alpha.19",
    "@material-ui/icons": "^4.11.2",
    "@material-ui/lab": "^4.0.0-alpha.57",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "aws-amplify": "^3.3.26",
    "axios": "^0.21.1",
    "axios-auth-refresh": "^3.1.0",
    "eslint-plugin-react": "^7.23.2",
    "material-ui-chip-input": "^2.0.0-beta.2",
    "material-ui-dropzone": "^3.5.0",
    "mui-datatables": "^3.7.6",
    "prop-types": "^15.7.2",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-file-icon": "^1.0.0",
    "react-helmet-async": "^1.0.7",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.2",
    "react-transition-group": "^4.4.1",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest",
      "eslint-config-airbnb"
    ],
    "rules": {
      "jsx-a11y/click-events-have-key-events": "off",
      "jsx-a11y/no-noninteractive-element-interactions": "off",
      "react/jsx-props-no-spreading": "off",
      "react/jsx-no-bind": "off",
      "linebreak-style": "off"
    }
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "eslint-config-airbnb": "^18.2.1"
  }
}

Webpack error: error:0308010C:digital envelope routines::unsupported

Seems that the webpack is not compatible with the node version running in the docker image. I'm quite new to nodejs and can't figure out the problem by myself since i've never used webpack before. could you please assist me?
Webpack just released a new version of webpack https://github.com/webpack/webpack/releases/tag/v5.61.0 that should be compatible but i can't figure out how webpack gets introduced in the project.

rn run v1.22.17
$ react-scripts build
Creating an optimized production build...
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (/asset-input/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/asset-input/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/asset-input/node_modules/webpack/lib/NormalModule.js:471:10)
at /asset-input/node_modules/webpack/lib/NormalModule.js:503:5
at /asset-input/node_modules/webpack/lib/NormalModule.js:358:12
at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at runSyncOrAsync (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
at Array. (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/asset-input/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at /asset-input/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
/asset-input/node_modules/react-scripts/scripts/build.js:19
throw err;
^

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (/asset-input/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/asset-input/node_modules/webpack/lib/NormalModule.js:417:16)
at /asset-input/node_modules/webpack/lib/NormalModule.js:452:10
at /asset-input/node_modules/webpack/lib/NormalModule.js:323:13
at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /asset-input/node_modules/react-scripts/node_modules/babel-loader/lib/index.js:59:103 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v17.3.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

C:\git-repos\React\ps-serverless-app\node_modules@aws-cdk\core\lib\asset-staging.ts:472
for (const key of Object.keys(object).sort()) {
^
Error: Failed to bundle asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage, bundle output is located at C:\git-repos\React\ps-serverless-app\infrastructure\cdk.out\asset.a2537f899bb0358007d10021fdccddce4faf6344e6dc86c9a335d8a31bf2f575-error: Error: docker exited with status 1
at AssetStaging.bundle (C:\git-repos\React\ps-serverless-app\node_modules@aws-cdk\core\lib\asset-staging.ts:472:13)
at AssetStaging.stageByBundling (C:\git-repos\React\ps-serverless-app\node_modules@aws-cdk\core\lib\asset-staging.ts:330:10)
at stageThisAsset (C:\git-repos\React\ps-serverless-app\node_modules@aws-cdk\core\lib\asset-staging.ts:196:35)
at Cache.obtain (C:\git-repos\React\ps-serverless-app\node_modules@aws-cdk\core\lib\private\cache.ts:24:13)
at new AssetStaging (C:\git-repos\React\ps-serverless-app\node_modules@aws-cdk\core\lib\asset-staging.ts:221:44)
at new Asset (C:\git-repos\React\ps-serverless-app\node_modules@aws-cdk\aws-s3-assets\lib\asset.ts:127:21)
at Object.bind (C:\git-repos\React\ps-serverless-app\node_modules@aws-cdk\aws-s3-deployment\lib\source.ts:89:23)
at C:\git-repos\React\ps-serverless-app\node_modules@aws-cdk\aws-s3-deployment\lib\bucket-deployment.ts:213:83
at Array.map ()
at new BucketDeployment (C:\git-repos\React\ps-serverless-app\node_modules@aws-cdk\aws-s3-deployment\lib\bucket-deployment.ts:213:51)
Subprocess exited with error 1

C:\git-repos\React\ps-serverless-app\infrastructure>node version
node version
internal/modules/cjs/loader.js:888
throw err;
^

Error: Cannot find module 'C:\git-repos\React\ps-serverless-app\infrastructure\version'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

PS:
There is a unsafe workaround, but as mentioned it's unsafe.
https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported

Issue deploying the p2 branch: `EACCES: permission denied, unlink '/asset-input/webapp/build/favicon.ico'`

I am getting the following permissions issue when running npx cdk deploy on the p2 branch. I am running into a permissions error:

lrobbins@arucard:~/learning/aws/ps-serverless-app/infrastructure (p2) $ npx cdk deploy
Bundling asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage...
yarn run v1.22.19
$ react-scripts build
Failed to compile.

EACCES: permission denied, unlink '/asset-input/webapp/build/favicon.ico'


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:478
      throw new Error(`Failed to bundle asset ${this.node.path}, bundle output is located at ${bundleErrorDir}: ${err}`);
            ^
Error: Failed to bundle asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage, bundle output is located at /home/lrobbins/learning/aws/ps-serverless-app/infrastructure/cdk.out/asset.b9fc501666ca534257b3491fb4db2cef743ff767aa2adffcf0df33a11ba34441-error: Error: docker exited with status 1
    at AssetStaging.bundle (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:478:13)
    at AssetStaging.stageByBundling (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:326:10)
    at stageThisAsset (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:192:35)
    at Cache.obtain (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/private/cache.ts:24:13)
    at new AssetStaging (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:217:44)
    at new Asset (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/aws-s3-assets/lib/asset.ts:134:21)
    at Object.bind (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/aws-s3-deployment/lib/source.ts:108:23)
    at /home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts:327:83
    at Array.map (<anonymous>)
    at new BucketDeployment (/home/lrobbins/learning/aws/ps-serverless-app/node_modules/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts:327:51)

Subprocess exited with error 1

After doing a web search. I found this and made sure the NPM_CONFIG_PREFIX was set correctly according to the guide on the NPM docs and I've confirmed that the npm config is now correct.


lrobbins@arucard:~ $ npm -v
10.2.5

lrobbins@arucard:~ $ node -v
v18.18.2


lrobbins@arucard:~ $ npm config list
; "user" config from /home/lrobbins/.npmrc

; prefix = "/home/lrobbins/.npm-global" ; overridden by env

; "env" config from environment

prefix = "/home/lrobbins/.npm-global" 

; node bin location = /usr/bin/node
; node version = v18.18.2
; npm local prefix = /home/lrobbins
; npm version = 10.2.5
; cwd = /home/lrobbins
; HOME = /home/lrobbins
; Run `npm config ls -l` to show all defaults.

Unfortunately this made no difference.

p3: Cannot find 'path'

lib/core/services.ts:1:23 - error TS2307: Cannot find module 'path' or its corresponding type declarations.

1 import * as path from 'path'

WebApp Deployment Failed

Hello David and thank you very much for this amazing CDK path.

I am following your videos using this git repo but I am having an issue deploying to CloudFront in the P1 branch using cdkv2.

I posted the error below which I got after I run npx cdk deploy

Error: Bundling did not produce any output. Check that content is written to /asset-output.
at AssetStaging.bundle (/Users/khaled.ali/development/AWS/Projects/WEB/CDK/ps-serverless-app/node_modules/aws-cdk-lib/core/lib/asset-staging.js:2:841)
at AssetStaging.stageByBundling (/Users/khaled.ali/development/AWS/Projects/WEB/CDK/ps-serverless-app/node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:4506)
at stageThisAsset (/Users/khaled.ali/development/AWS/Projects/WEB/CDK/ps-serverless-app/node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:1867)
at Cache.obtain (/Users/khaled.ali/development/AWS/Projects/WEB/CDK/ps-serverless-app/node_modules/aws-cdk-lib/core/lib/private/cache.js:1:242)
at new AssetStaging (/Users/khaled.ali/development/AWS/Projects/WEB/CDK/ps-serverless-app/node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2262)
at new Asset (/Users/khaled.ali/development/AWS/Projects/WEB/CDK/ps-serverless-app/node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:736)
at Object.bind (/Users/khaled.ali/development/AWS/Projects/WEB/CDK/ps-serverless-app/node_modules/aws-cdk-lib/aws-s3-deployment/lib/source.js:1:1200)
at /Users/khaled.ali/development/AWS/Projects/WEB/CDK/ps-serverless-app/node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:2867
at Array.map ()
at new BucketDeployment (/Users/khaled.ali/development/AWS/Projects/WEB/CDK/ps-serverless-app/node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:2848)

You help is appreciated

Khaled Ali

Eventbus and Cloudtrail

With the code as is the event bus will not get events without setting up a CloudTrail to monitor the upload bucket. Once CloudTrail is set up this is another issue, it adds a logs folder to the bucket. So every time a new log file is added the Step Function is triggered and fails. Is there a way to filter the events to ignore the 'AWSLogs' folder?

CloudTrail not enabled by default

const uploadRule = props.uploadBucket.onCloudTrailWriteObject('UploadRule', {});

I had an issue with this section as my S3 bucket did not create a cloud trail event and so when I ran the service at the end of the Event-based actions module the state machine did not start. If you review the docs for onCloudTrailWriteObject you will see that it "requires at least one CloudTrail Trail in your account that captures the event". As a new-ish user of AWS I didn't have one (I wonder if this is a default that has now changed).

I fixed it as follows:

  1. import * as cloudtrail from '@aws-cdk/aws-cloudtrail';
  2. const trail = new cloudtrail.Trail(this, 'CloudTrail');
  3. trail.logAllS3DataEvents();

Might be worth including this by default?

fail: Inaccessible host: `cdk-hnb659fds-assets-XXXXX-us-east-1.s3.amazonaws.com'

Hello @davidtucker ,
First of all this is a good course and a starting point for CDK / Pipeline etc.
I have tried to setup the project and run it in AWS and noticed that I'm getting below error for some zip file uploads:

fail: Inaccessible host: cdk-hnb659fds-assets-xxxxx-us-east-1.s3.amazonaws.com'. This service may not be available in the us-east-1' region.

So my ApplicationStack / PipelinStack are failing to complete deployment..

I was able to successfully upload some assets and some are failing, any advise is much appreciated.

Thanks
Chris

Error yarn start

Hi i got the next error when i executed yarn start on the terminal

TypeError: Cannot read property 'apiEndpoint' of undefined

P1 Final Building and Deploying the React Web App fails

Was successful with the Creating and Deploying S3 Buckets

When I got the final deploy I thought my code was wrong, so I tried again with the P2 starting code, still the same error:

Bundling asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage...
yarn run v1.22.19
warning Skipping preferred cache folder "/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-501".
$ react-scripts build
warning Cannot find a suitable global folder. Tried these: "/usr/local, /.yarn"
Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

/Users/dalehurley/Code/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:472
  for (const key of Object.keys(object).sort()) {
            ^
Error: Failed to bundle asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage, bundle output is located at /Users/dalehurley/Code/ps-serverless-app/infrastructure/cdk.out/asset.070ed49bd1168d58cc573560efe0caa361680a2adbce4850f66d5229e1038644-error: Error: docker exited with status 1
    at AssetStaging.bundle (/Users/dalehurley/Code/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:472:13)
    at AssetStaging.stageByBundling (/Users/dalehurley/Code/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:330:10)
    at stageThisAsset (/Users/dalehurley/Code/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:196:35)
    at Cache.obtain (/Users/dalehurley/Code/ps-serverless-app/node_modules/@aws-cdk/core/lib/private/cache.ts:24:13)
    at new AssetStaging (/Users/dalehurley/Code/ps-serverless-app/node_modules/@aws-cdk/core/lib/asset-staging.ts:221:44)
    at new Asset (/Users/dalehurley/Code/ps-serverless-app/node_modules/@aws-cdk/aws-s3-assets/lib/asset.ts:127:21)
    at Object.bind (/Users/dalehurley/Code/ps-serverless-app/node_modules/@aws-cdk/aws-s3-deployment/lib/source.ts:89:23)
    at /Users/dalehurley/Code/ps-serverless-app/

Can't run the p1 path

I am not sure if anyone else faced this problem but after importing p1 and using yarn to install all dependencies. I ran "yarn start" from the webapp folder and it gave me the next error in the browser. Could you please help? @davidtucker

TypeError: Cannot read properties of undefined (reading 'apiEndpoint')
Module.
F:/ServerLess/ps-serverless-app-p1/ps-serverless-app/webapp/src/services/index.js:5
2 | import createAuthRefreshInterceptor from 'axios-auth-refresh';
3 | import { Auth } from 'aws-amplify';
4 |

5 | const SERVICES_HOST = window.appConfig.apiEndpoint;
6 | let client;
7 |
8 | /* eslint-disable no-console */

Error: error:0308010C:digital envelope routines::unsupported on "yarn start" command

I am getting the following error when running the "yarn start" command on the initial p1 branch. Node version v20.9.0 and yarn version 1.22.22.

Steps:

  1. Ran "yarn" command on the root directory.
  2. Changed to webapp directory and ran "yarn start".

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:68:19)
at Object.createHash (node:crypto:138:10)
at module.exports (D:\AWS\ps-serverless-app\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\AWS\ps-serverless-app\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\AWS\ps-serverless-app\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\AWS\ps-serverless-app\node_modules\webpack\lib\NormalModule.js:503:5
at D:\AWS\ps-serverless-app\node_modules\webpack\lib\NormalModule.js:358:12
at D:\AWS\ps-serverless-app\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\AWS\ps-serverless-app\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (D:\AWS\ps-serverless-app\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
D:\AWS\ps-serverless-app\node_modules\react-scripts\scripts\start.js:19

Suggestion/research: Security - "Prevent requests from accessing API directly"

Summary: As a security hardening approach, it makes sense to deny "backdoor" requests to your API, unless coming from Cloudfront ...

Of course, switching this on will make Postman testing more difficult, so might be an idea to make it easily switchable.

Might post some code updates here, if it all works.

https://www.wellarchitectedlabs.com/security/300_labs/300_multilayered_api_security_with_cognito_and_waf/3_prevent_requests_from_accessing_api_directly/

Region hardcoded in Ghostscript layer: Comment includes fix/workaround

Branch main (and others with PDF processing)
ps-serverless-app/infrastructure/lib/core/processing.ts:

layers: [
lambda.LayerVersion.fromLayerVersionAttributes(this, 'GhostscriptLayerVersion', {
layerVersionArn: 'arn:aws:lambda:us-east-2:764866452798:layer:ghostscript:8',
compatibleRuntimes: [lambda.Runtime.NODEJS_14_X],
}),

Think this ought to be made to agree with the build/deploy account region.

npx cdk deploy gives this error: can't cd to webapp

Hi @davidtucker , first of all thanks for the excellent pluralsight tutorial, but I am currently stuck during deployment.

I just cloned the p2 branch and ran yarn install, but when I cd to the infrastructure directory and run npx cdk deploy is spits out this error:

Bundling asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage...
/bin/sh: 2: cd: can't cd to webapp.

image

I didn't change anything in the code, it is just a fresh untouched p2 branch.

I am running this build in a docker container so that I can install the same node and yarn version as in the tutorial, only the aws cli is the v2 version (as opposed to v1 you were using), I upgraded to aws cli v2 because I thought it could fix the issue.

If I attempted to use latest versions of node, yarn, npm, cdk, etc I will face a lot of more errors due to outdated packages being used.

Here are my tooling versions if you want to check:

image

node v16.20.2
npm 8.19.4
yarn 1.22.5
aws cli 2.15.34
ubuntu 20.04.4 LTS

I know it might be hard for you to reproduce this issue, but if you do have a few tips please let me know..., in the meantime I will just watch the tutorial and won't be following along...

Regards.

Cannot read property 'addToResourcePolicy' of undefined

Hi, I am getting the following when running "npx cdk deploy" at the end of the "Deploying a CloudFront Distribution video. "Cannot read property 'addToResourcePolicy' of undefined" Could it be related to the IAM user I have connected in the credentials?

This is at the end of the p1 branch.

The below code seems to be where the error is occurring, although the CDK is tricky to debug.

this.webDistribution = new cloudfront.CloudFrontWebDistribution(
this,
'AppHostingDistribution',
cloudfrontProps,
);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.