Guria / aws-js-practitioner

https://aws-js-practitioner-dev.guria.dev/
1 stars 0 forks source link

Task5.3: implement parsing uploaded csv #26

Closed Guria closed 2 years ago

Guria commented 2 years ago

:heavy_check_mark: Create a lambda function importFileParser which will be triggered by an S3 event. :heavy_check_mark: The event should be s3:ObjectCreated:* :heavy_check_mark: Configure the event to be fired only by changes in the uploaded folder in S3. :heavy_check_mark: The lambda function use a readable stream to get an object from S3, parse it using csv-parser package and logs each record to be shown in CloudWatch.

Additional tasks: :heavy_plus_sign: Business logic of importProductsFile lambda is covered by unit tests :heavy_plus_sign: At the end of the stream the lambda function moves the file from the uploaded folder into the parsed folder

github-actions[bot] commented 2 years ago

Build output

Deploying to stage task5-3 api-gateway › waiting fe-distribution › waiting fixtures › waiting products-api › waiting products-import › waiting shop-frontend-app › waiting api-gateway › deploying fe-distribution › deploying api-gateway › Running "serverless deploy --stage task5-3 --param ResourcePrefix=ajp-task5-3" fe-distribution › Running "serverless deploy --stage task5-3 --param ResourcePrefix=ajp-task5-3" api-gateway › Deploying ajp-api-gateway to stage task5-3 (us-east-1) fe-distribution › Deploying ajp-fe-distribution to stage task5-3 (us-east-1) api-gateway › Change set did not include any changes to be deployed. (1s) fe-distribution › Change set did not include any changes to be deployed. (2s) api-gateway › Running "serverless info --verbose --stage task5-3 --param ResourcePrefix=ajp-task5-3" fe-distribution › Running "serverless info --verbose --stage task5-3 --param ResourcePrefix=ajp-task5-3" api-gateway › service: ajp-api-gateway api-gateway › stage: task5-3 api-gateway › region: us-east-1 api-gateway › stack: ajp-api-gateway-task5-3 api-gateway › api-gateway › Stack Outputs: api-gateway › ApiGatewayRestApiId: zyv1i3jjig api-gateway › ApiGatewayRestApiEndpoint: https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3 api-gateway › ApiGatewayRestApiRootResourceId: dgitp4xj04 api-gateway › ServerlessDeploymentBucketName: ajp-api-gateway-task5-3-serverlessdeploymentbucke-1n2a9ezyxglie api-gateway › deployed fe-distribution › service: ajp-fe-distribution fe-distribution › stage: task5-3 fe-distribution › region: us-east-1 fe-distribution › stack: ajp-fe-distribution-task5-3 fe-distribution › Stack Outputs: fe-distribution › WebAppCustomDomain: ajp-task5-3.guria.dev fe-distribution › WebAppDistributionDomain: d2zbm1u618rlmk.cloudfront.net fe-distribution › WebAppDistributionId: EA07UP7OJRJ5G fe-distribution › WebAppS3BucketName: ajp-task5-3-s3 fe-distribution › ServerlessDeploymentBucketName: ajp-fe-distribution-task-serverlessdeploymentbuck-4np2ugv52bo4 fe-distribution › deployed fixtures › deploying fixtures › Running "serverless deploy --stage task5-3 --param ResourcePrefix=ajp-task5-3 --param WebAppDistributionDomain=d2zbm1u618rlmk.cloudfront.net --param WebAppCustomDomain=ajp-task5-3.guria.dev" fixtures › Deploying ajp-fixtures to stage task5-3 (us-east-1) fixtures › Change set did not include any changes to be deployed. (2s) fixtures › Running "serverless info --verbose --stage task5-3 --param ResourcePrefix=ajp-task5-3 --param WebAppDistributionDomain=d2zbm1u618rlmk.cloudfront.net --param WebAppCustomDomain=ajp-task5-3.guria.dev" fixtures › service: ajp-fixtures fixtures › stage: task5-3 fixtures › region: us-east-1 fixtures › stack: ajp-fixtures-task5-3 fixtures › fixtures › Stack Outputs: fixtures › FixturesS3BucketName: ajp-task5-3-fixtures fixtures › ServerlessDeploymentBucketName: ajp-fixtures-task5-3-serverlessdeploymentbucket-17xngodxgedxz fixtures › deployed products-api › deploying products-import › deploying products-api › Running "serverless deploy --stage task5-3 --param ResourcePrefix=ajp-task5-3 --param FixturesS3BucketName=ajp-task5-3-fixtures --param ApiGatewayRestApiId=zyv1i3jjig --param ApiGatewayRestApiRootResourceId=dgitp4xj04 --param WebAppDistributionDomain=d2zbm1u618rlmk.cloudfront.net --param WebAppCustomDomain=ajp-task5-3.guria.dev" products-import › Running "serverless deploy --stage task5-3 --param ResourcePrefix=ajp-task5-3 --param FixturesS3BucketName=ajp-task5-3-fixtures --param ApiGatewayRestApiId=zyv1i3jjig --param ApiGatewayRestApiRootResourceId=dgitp4xj04 --param WebAppDistributionDomain=d2zbm1u618rlmk.cloudfront.net --param WebAppCustomDomain=ajp-task5-3.guria.dev" products-import › Deploying ajp-products-import to stage task5-3 (us-east-1) products-api › Deploying ajp-products-api to stage task5-3 (us-east-1) products-import › ✔ Service deployed to stack ajp-products-import-task5-3 (43s) products-import › endpoint: GET - https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3/import products-import › functions: products-import › importProductsFile: ajp-products-import-task5-3-importProductsFile (194 kB) products-import › importFileParser: ajp-products-import-task5-3-importFileParser (187 kB) products-import › 1 deprecation found: run 'serverless doctor' for more details products-import › Running "serverless info --verbose --stage task5-3 --param ResourcePrefix=ajp-task5-3 --param FixturesS3BucketName=ajp-task5-3-fixtures --param ApiGatewayRestApiId=zyv1i3jjig --param ApiGatewayRestApiRootResourceId=dgitp4xj04 --param WebAppDistributionDomain=d2zbm1u618rlmk.cloudfront.net --param WebAppCustomDomain=ajp-task5-3.guria.dev" products-import › service: ajp-products-import products-import › stage: task5-3 products-import › region: us-east-1 products-import › stack: ajp-products-import-task5-3 products-import › endpoint: GET - https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3/import products-import › functions: products-import › importProductsFile: ajp-products-import-task5-3-importProductsFile products-import › importFileParser: ajp-products-import-task5-3-importFileParser products-import › Stack Outputs: products-import › ImportProductsFileLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:609136581632:function:ajp-products-import-task5-3-importProductsFile:1 products-import › ImportFileParserLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:609136581632:function:ajp-products-import-task5-3-importFileParser:1 products-import › ServiceEndpoint: https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3 products-import › ServerlessDeploymentBucketName: ajp-products-import-task-serverlessdeploymentbuck-obr9rtsw6gd5 products-import › 1 deprecation found: run 'serverless doctor' for more details products-import › deployed products-api › ✔ Service deployed to stack ajp-products-api-task5-3 (304s) products-api › endpoints: products-api › GET - https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3/products products-api › GET - https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3/products/{productId} products-api › POST - https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3/products products-api › functions: products-api › getProductsList: ajp-products-api-task5-3-getProductsList (198 kB) products-api › getProductById: ajp-products-api-task5-3-getProductById (198 kB) products-api › createProduct: ajp-products-api-task5-3-createProduct (199 kB) products-api › Running "serverless info --verbose --stage task5-3 --param ResourcePrefix=ajp-task5-3 --param FixturesS3BucketName=ajp-task5-3-fixtures --param ApiGatewayRestApiId=zyv1i3jjig --param ApiGatewayRestApiRootResourceId=dgitp4xj04 --param WebAppDistributionDomain=d2zbm1u618rlmk.cloudfront.net --param WebAppCustomDomain=ajp-task5-3.guria.dev" products-api › service: ajp-products-api products-api › stage: task5-3 products-api › region: us-east-1 products-api › stack: ajp-products-api-task5-3 products-api › endpoints: products-api › GET - https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3/products products-api › GET - https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3/products/{productId} products-api › POST - https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3/products products-api › functions: products-api › getProductsList: ajp-products-api-task5-3-getProductsList products-api › getProductById: ajp-products-api-task5-3-getProductById products-api › createProduct: ajp-products-api-task5-3-createProduct products-api › products-api › Stack Outputs: products-api › GetProductByIdLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:609136581632:function:ajp-products-api-task5-3-getProductById:1 products-api › GetProductsListLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:609136581632:function:ajp-products-api-task5-3-getProductsList:1 products-api › CreateProductLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:609136581632:function:ajp-products-api-task5-3-createProduct:1 products-api › ServiceEndpoint: https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3 products-api › ServerlessDeploymentBucketName: ajp-products-api-task5-3-serverlessdeploymentbuck-1ecun5pws0n7u products-api › deployed shop-frontend-app › deploying shop-frontend-app › Running "serverless deploy --stage task5-3 --param ApiGatewayRestApiId=zyv1i3jjig --param ProductsApiServiceEndpoint=https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3 --param WebAppS3BucketName=ajp-task5-3-s3 --param WebAppDistributionId=EA07UP7OJRJ5G --param WebAppDistributionDomain=d2zbm1u618rlmk.cloudfront.net --param WebAppCustomDomain=ajp-task5-3.guria.dev" shop-frontend-app › Deploying ajp-shop-frontend to stage task5-3 (us-east-1) shop-frontend-app › Running command: aws --version shop-frontend-app › aws apigateway get-export --parameters extensions='apigateway' --rest-api-id zyv1i3jjig --stage-name task5-3 --export-type swagger public/swagger.json shop-frontend-app › echo "CONFIG = {BASE_URL: \"https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3\"}" > public/config.js shop-frontend-app › npm run build shop-frontend-app › aws-cli/2.8.5 Python/3.9.11 Linux/5.15.0-1022-azure exe/x86_64.ubuntu.20 prompt/off shop-frontend-app › { shop-frontend-app › "contentType": "application/octet-stream", shop-frontend-app › "contentDisposition": "attachment; filename=\"swagger_2022-10-29T15:19:02Z.json\"" shop-frontend-app › } shop-frontend-app › > @guria.dev/aws-js-practitioner-shop-frontend@1.0.0 build shop-frontend-app › > tsc && vite build shop-frontend-app › vite v3.1.8 building for production... shop-frontend-app › transforming... shop-frontend-app › ✓ 3422 modules transformed. shop-frontend-app › warnings when minifying css: shop-frontend-app › ▲ [WARNING] Expected identifier but found "" [css-syntax-error] shop-frontend-app › shop-frontend-app › :1:30219: shop-frontend-app › 1 │ ...fter{clear:both}.swagger-ui .cf{zoom:1}.swagger-ui .cl{clear:le... shop-frontend-app › ╵ ^ shop-frontend-app › shop-frontend-app › shop-frontend-app › rendering chunks... shop-frontend-app › dist/index.html 0.64 KiB shop-frontend-app › dist/assets/dehydrated.eb01c8e5.js 0.58 KiB / gzip: 0.33 KiB shop-frontend-app › dist/assets/SwaggerStyles.b21286a4.js 0.05 KiB / gzip: 0.06 KiB shop-frontend-app › dist/assets/libs.f5f78b2b.js 115.30 KiB / gzip: 38.24 KiB shop-frontend-app › dist/assets/SwaggerStyles.e392df80.css 140.02 KiB / gzip: 22.23 KiB shop-frontend-app › dist/assets/index.26c06347.js 216.30 KiB / gzip: 65.65 KiB shop-frontend-app › dist/assets/react.988ba9ed.js 198.68 KiB / gzip: 60.68 KiB shop-frontend-app › dist/assets/swagger.6113cd3b.js 898.47 KiB / gzip: 281.29 KiB shop-frontend-app › DistributionId: EA07UP7OJRJ5G shop-frontend-app › CloudfrontInvalidate: Invalidation started shop-frontend-app › Web App deployed to Cloudfront and available at following addresses: shop-frontend-app › https://d2zbm1u618rlmk.cloudfront.net shop-frontend-app › https://ajp-task5-3.guria.dev shop-frontend-app › Swagger Schema available at: shop-frontend-app › https://ajp-task5-3.guria.dev/swagger.json shop-frontend-app › Swagger UI available at: shop-frontend-app › https://ajp-task5-3.guria.dev/swagger shop-frontend-app › ✔ Service deployed to stack ajp-shop-frontend-task5-3 (97s) shop-frontend-app › Running "serverless info --verbose --stage task5-3 --param ApiGatewayRestApiId=zyv1i3jjig --param ProductsApiServiceEndpoint=https://zyv1i3jjig.execute-api.us-east-1.amazonaws.com/task5-3 --param WebAppS3BucketName=ajp-task5-3-s3 --param WebAppDistributionId=EA07UP7OJRJ5G --param WebAppDistributionDomain=d2zbm1u618rlmk.cloudfront.net --param WebAppCustomDomain=ajp-task5-3.guria.dev" shop-frontend-app › service: ajp-shop-frontend shop-frontend-app › stage: task5-3 shop-frontend-app › region: us-east-1 shop-frontend-app › stack: ajp-shop-frontend-task5-3 shop-frontend-app › shop-frontend-app › Stack Outputs: shop-frontend-app › ServerlessDeploymentBucketName: ajp-shop-frontend-task5-serverlessdeploymentbuck-1pxmpoxtgpsov shop-frontend-app › deployed

github-actions[bot] commented 2 years ago

Deployment removed