Skip to content

Cannot complete Cloud Quest: Serverless Chatbot Using Private Data

-1

It seems to me that there is a bug in Cloud Quest: Serverless Chatbot Using Private Data | Practice | Step 34/75

Running .startup.sh generates multiple errors:

AWSLabsUser-hw893NXLAajTk87X5ZaDL6:~/environment/serverless-chatbot-code $ ./startup.sh 
Preparing CodeEditor for project deploymnet
v18.17.1
Set region
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'boto3'
AWS Region is 
Build the backend code using sam build

        SAM CLI now collects telemetry to better understand customer needs.

        You can OPT OUT and disable telemetry collection by setting the
        environment variable SAM_CLI_TELEMETRY=0 in your shell.
        Thanks for your help!

        Learn More: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-telemetry.html

Building codeuri: /home/ec2-user/environment/serverless-chatbot-code/lambdas/cognitoUser runtime: python3.10 metadata: {} architecture: x86_64 functions: CognitoUserCreateFunction                                                                                                                                                            
requirements.txt file not found. Continuing the build without dependencies.                                                                                                                                                                                                                                                                    

Build Failed
Error: PythonPipBuilder:Validation - Binary validation failed for python, searched for python in following locations  : ['/usr/bin/python', '/usr/bin/python3'] which did not satisfy constraints for runtime: python3.10. Do you have python for runtime: python3.10 on your PATH?
Export S3 bucket name and Kendra index which are created as part of Startup CFN stack

Invalid endpoint: https://s3..amazonaws.com

Invalid endpoint: https://s3..amazonaws.com

Invalid endpoint: https://kendra..amazonaws.com
sam-bedrock-stack
Copy toml file and replace the parameters
Deploy app with sam deploy

Error: Invalid endpoint: https://s3..amazonaws.com
Traceback:
  File "click/core.py", line 1078, in main
  File "click/core.py", line 1688, in invoke
  File "click/core.py", line 1434, in invoke
  File "click/core.py", line 783, in invoke
  File "samcli/cli/cli_config_file.py", line 347, in wrapper
  File "samcli/lib/cli_validation/image_repository_validation.py", line 111, in wrapped
  File "click/decorators.py", line 92, in new_func
  File "click/core.py", line 783, in invoke
  File "samcli/lib/telemetry/metric.py", line 185, in wrapped
  File "samcli/lib/telemetry/metric.py", line 150, in wrapped
  File "samcli/lib/utils/version_checker.py", line 43, in wrapped
  File "samcli/cli/main.py", line 95, in wrapper
  File "samcli/commands/_utils/cdk_support_decorators.py", line 40, in wrapped
  File "samcli/commands/_utils/command_exception_handler.py", line 89, in wrapper_command_exception_handler
  File "samcli/commands/_utils/command_exception_handler.py", line 69, in wrapper_command_exception_handler
  File "samcli/commands/deploy/command.py", line 201, in cli
  File "samcli/commands/deploy/command.py", line 330, in do_cli
  File "samcli/commands/package/package_context.py", line 118, in run
  File "boto3/__init__.py", line 92, in client
  File "boto3/session.py", line 299, in client
  File "botocore/session.py", line 997, in create_client
  File "botocore/client.py", line 161, in create_client
  File "botocore/client.py", line 508, in _get_client_args
  File "botocore/args.py", line 137, in get_client_args
  File "botocore/endpoint.py", line 402, in create_endpoint

An unexpected error was encountered while executing "sam deploy".
Search for an existing issue:
https://github.com/aws/aws-sam-cli/issues?q=is%3Aissue+is%3Aopen+Bug%3A%20sam%20deploy%20-%20ValueError
Or create a bug report:
https://github.com/aws/aws-sam-cli/issues/new?template=Bug_report.md&title=Bug%3A%20sam%20deploy%20-%20ValueError
Export few more parameters

Invalid endpoint: https://cloudformation..amazonaws.com

Invalid endpoint: https://cognito-idp..amazonaws.com

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

aws: error: argument --user-pool-id: expected one argument

Gateway endpoint: 
Cognito user pool id: 
Cognito client id: 
Install Amplify and build frontend
./startup.sh: line 53: cd: /home/ec2-user/serverless-chatbot-code/frontend: No such file or directory
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm warn deprecated consolidate@0.15.1: Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at https://forwardemail.net ; follow/watch https://github.com/ladjs/consolidate for updates and release changelog
npm warn deprecated webpack-chain@6.5.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

added 652 packages, and audited 656 packages in 38s

88 packages are looking for funding
  run `npm fund` for details

4 moderate severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
npm warn deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.

added 175 packages, and audited 831 packages in 18s

99 packages are looking for funding
  run `npm fund` for details

4 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

added 33 packages in 21s

7 packages are looking for funding
  run `npm fund` for details

up to date, audited 831 packages in 4s

99 packages are looking for funding
  run `npm fund` for details

4 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm error Missing script: "build"
npm error
npm error To see a list of scripts, run:
npm error   npm run
npm error A complete log of this run can be found in: /home/ec2-user/.npm/_logs/2024-08-08T09_04_54_965Z-debug-0.log
Amplify initialization
mv: cannot stat ‘dist’: No such file or directory
Note: It is recommended to run this command from the root of your app directory
The following configuration will be applied:

Project information
| Name: serverlesschatbotcod
| Environment: dev
| Default editor: Visual Studio Code
| App type: javascript
| Javascript framework: none
| Source Directory Path: src
| Distribution Directory Path: dist
| Build Command: npm run-script build
| Start Command: npm run-script start

Using default provider  awscloudformation
Adding backend environment dev to AWS Amplify app: dvs2jhfvn9vnq

Deployment failed.
Deploying root stack serverlesschatbotcod [ ==========------------------------------ ] 1/4
        amplify-serverlesschatbotcod-… AWS::CloudFormation::Stack     ROLLBACK_COMPLETE              Thu Aug 08 2024 09:05:11…     
        UnauthRole                     AWS::IAM::Role                 CREATE_FAILED                  Thu Aug 08 2024 09:05:06…     
        DeploymentBucket               AWS::S3::Bucket                CREATE_FAILED                  Thu Aug 08 2024 09:05:06…     
        AuthRole                       AWS::IAM::Role                 CREATE_FAILED                  Thu Aug 08 2024 09:05:05…     


An error occurred when creating the CloudFormation stack
🛑 The following resources failed to deploy:
Resource Name: UnauthRole (AWS::IAM::Role)
Event Type: create
Reason: Resource handler returned message: "Encountered a permissions error performing a tagging operation, please add required tag permissions. See https://repost.aws/knowledge-center/cloudformation-tagging-permission-error for how to resolve. Resource handler returned message: "User: arn:aws:sts::043526341454:assumed-role/AWSLabsUser-hw893NXLAajTk87X5ZaDL6/d7830696-32d9-479a-a72b-1750b00fbf6a is not authorized to perform: iam:CreateRole on resource: arn:aws:iam::043526341454:role/amplify-serverlesschatbotcod-dev-a01cd-unauthRole because no identity-based policy allows the iam:CreateRole action (Service: Iam, Status Code: 403, Request ID: 23699787-37a9-4890-bea5-fe4fedd529a3)"" (RequestToken: 90a92103-9860-f2a3-d518-0dd24886b13c, HandlerErrorCode: UnauthorizedTaggingOperation)


Resource Name: AuthRole (AWS::IAM::Role)
Event Type: create
Reason: Resource handler returned message: "Encountered a permissions error performing a tagging operation, please add required tag permissions. See https://repost.aws/knowledge-center/cloudformation-tagging-permission-error for how to resolve. Resource handler returned message: "User: arn:aws:sts::043526341454:assumed-role/AWSLabsUser-hw893NXLAajTk87X5ZaDL6/d7830696-32d9-479a-a72b-1750b00fbf6a is not authorized to perform: iam:CreateRole on resource: arn:aws:iam::043526341454:role/amplify-serverlesschatbotcod-dev-a01cd-authRole because no identity-based policy allows the iam:CreateRole action (Service: Iam, Status Code: 403, Request ID: 480f9348-7426-472e-88f9-de12d22c826a)"" (RequestToken: 6dc654fa-37e1-381d-6b53-5991bf430476, HandlerErrorCode: UnauthorizedTaggingOperation)


🛑 Initialization of project failed
Name: UnauthRole (AWS::IAM::Role), Event Type: create, Reason: Resource handler returned message: "Encountered a permissions error performing a tagging operation, please add required tag permissions. See https://repost.aws/knowledge-center/cloudformation-tagging-permission-error for how to resolve. Resource handler returned message: "User: arn:aws:sts::043526341454:assumed-role/AWSLabsUser-hw893NXLAajTk87X5ZaDL6/d7830696-32d9-479a-a72b-1750b00fbf6a is not authorized to perform: iam:CreateRole on resource: arn:aws:iam::043526341454:role/amplify-serverlesschatbotcod-dev-a01cd-unauthRole because no identity-based policy allows the iam:CreateRole action (Service: Iam, Status Code: 403, Request ID: 23699787-37a9-4890-bea5-fe4fedd529a3)"" (RequestToken: 90a92103-9860-f2a3-d518-0dd24886b13c, HandlerErrorCode: UnauthorizedTaggingOperation), IsCustomResource: false

Name: AuthRole (AWS::IAM::Role), Event Type: create, Reason: Resource handler returned message: "Encountered a permissions error performing a tagging operation, please add required tag permissions. See https://repost.aws/knowledge-center/cloudformation-tagging-permission-error for how to resolve. Resource handler returned message: "User: arn:aws:sts::043526341454:assumed-role/AWSLabsUser-hw893NXLAajTk87X5ZaDL6/d7830696-32d9-479a-a72b-1750b00fbf6a is not authorized to perform: iam:CreateRole on resource: arn:aws:iam::043526341454:role/amplify-serverlesschatbotcod-dev-a01cd-authRole because no identity-based policy allows the iam:CreateRole action (Service: Iam, Status Code: 403, Request ID: 480f9348-7426-472e-88f9-de12d22c826a)"" (RequestToken: 6dc654fa-37e1-381d-6b53-5991bf430476, HandlerErrorCode: UnauthorizedTaggingOperation), IsCustomResource: false


Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: 31e6ee2a-268d-48be-ab02-e54e156bafa5
Add hosting, hit enter key if it prompts for action, use default
🛑 No Amplify backend project files detected within this folder.

Resolution: 
Either initialize a new Amplify project or pull an existing project.
- "amplify init" to initialize a new Amplify project
- "amplify pull <app-id>" to pull your existing Amplify project. Find the <app-id> in the AWS Console or Amplify Studio.

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: c902aa45-f3a9-4fc9-8106-4629121bc5a5
Publish the amplify project
🛑 No Amplify backend project files detected within this folder.

Resolution: 
Either initialize a new Amplify project or pull an existing project.
- "amplify init" to initialize a new Amplify project
- "amplify pull <app-id>" to pull your existing Amplify project. Find the <app-id> in the AWS Console or Amplify Studio.

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: bbb4427e-7d24-4e56-acfd-d6f79fafdcb0
AWSLabsUser-hw893NXLAajTk87X5ZaDL6:~/environment/serverless-chatbot-code $ 

Setting up AWS_REGION manually fixes some errors, but not all. Application still does not deploy. To me it looks like problems with environment including luck of python3.10 and installed boto3.

1 Answer
0

To better understand the issue, I have launched this lab and performed the following steps in order:

  1. Unzipped the serverless-chatbot-code.zip file.
  2. Navigated to the serverless-chatbot-code directory using the cd serverless-chatbot-code command.
  3. Did not make any changes to the folder.
  4. Executed the ./startup.sh script.
  5. For Amplify hosting, used the arrow keys on the keyboard to select "Amazon CloudFront and S3", and then pressed Enter.
  6. Proceeded to the next step.
  7. Pressed Enter to accept the default hosting bucket name.
  8. Proceeded to the next step.

I did not face the issue you reported. For the Amplify hosting step, you need to use the arrow keys on your keyboard to select the appropriate option. It seems you may have selected a different option during this step.

AWS
EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.