-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(typescript/bedrock-kb-agent) #1111
feat(typescript/bedrock-kb-agent) #1111
Conversation
); | ||
this.siteBucket.grantRead(originAccessIdentity); | ||
|
||
const s3origin = new cdk.aws_cloudfront_origins.S3Origin(this.siteBucket, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S3Origin has been deprecated can you update to S3OriginBucket.
Also your tests are failing please fix.
The deprecated api was removed. in the top level of the project, all the test are running
|
We run the following as defined in /scripts/build-typescript.sh Looks like you are missing you web-app directory. yarn install --mutex network
yarn build
npm run --if-present test + npm run --if-present test
FAIL test/bedrock-kb-agent-stack.test.ts (8.458 s)
BedrockKbAgentStack
✕ Cognito User Pool is created with correct name (275 ms)
✕ API Gateway HTTP API is created (36 ms)
✕ Lambda function is created with correct configuration (42 ms)
✕ At least one IAM policy includes required Bedrock permissions (39 ms)
✕ S3 bucket for knowledge base is created (38 ms)
✕ Bedrock Knowledge Base is created (39 ms)
✕ Bedrock Agent is created (46 ms)
✕ API Gateway routes are created (40 ms)
✕ Stack has the expected number of resources (41 ms)
● BedrockKbAgentStack › Cognito User Pool is created with correct name
Cannot find asset at /home/runner/work/aws-cdk-examples/aws-cdk-examples/typescript/bedrock-kb-agent/web-app/dist
192 | }
193 |
> 194 | new cdk.aws_s3_deployment.BucketDeployment(this, "DeployWithInvalidation", {
| ^
195 | sources: [
196 | cdk.aws_s3_deployment.Source.asset(props.webSiteBuildPath), // Main webapp from root directory
197 | cdk.aws_s3_deployment.Source.jsonData("config.json", amplifyConfig), // Amplify config file
at new AssetStaging (node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2221)
at new Asset (node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:1243)
at Object.bind (node_modules/aws-cdk-lib/aws-s3-deployment/lib/source.js:1:1562)
at node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3870
at Array.map (<anonymous>)
at new BucketDeployment (node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3851)
at new CloudFrontS3WebSiteConstruct (lib/constructs/cloudfront-s3-website-construct.ts:194:5)
at new BedrockKbAgentStack (lib/bedrock-kb-agent-stack.ts:35:21)
at Object.<anonymous> (test/bedrock-kb-agent-stack.test.ts:12:13)
● BedrockKbAgentStack › API Gateway HTTP API is created
Cannot find asset at /home/runner/work/aws-cdk-examples/aws-cdk-examples/typescript/bedrock-kb-agent/web-app/dist
192 | }
193 |
> 194 | new cdk.aws_s3_deployment.BucketDeployment(this, "DeployWithInvalidation", {
| ^
195 | sources: [
196 | cdk.aws_s3_deployment.Source.asset(props.webSiteBuildPath), // Main webapp from root directory
197 | cdk.aws_s3_deployment.Source.jsonData("config.json", amplifyConfig), // Amplify config file
at new AssetStaging (node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2221)
at new Asset (node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:1243)
at Object.bind (node_modules/aws-cdk-lib/aws-s3-deployment/lib/source.js:1:1562)
at node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3870
at Array.map (<anonymous>)
at new BucketDeployment (node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3851)
at new CloudFrontS3WebSiteConstruct (lib/constructs/cloudfront-s3-website-construct.ts:194:5)
at new BedrockKbAgentStack (lib/bedrock-kb-agent-stack.ts:35:21)
at Object.<anonymous> (test/bedrock-kb-agent-stack.test.ts:12:13)
● BedrockKbAgentStack › Lambda function is created with correct configuration
Cannot find asset at /home/runner/work/aws-cdk-examples/aws-cdk-examples/typescript/bedrock-kb-agent/web-app/dist
192 | }
193 |
> 194 | new cdk.aws_s3_deployment.BucketDeployment(this, "DeployWithInvalidation", {
| ^
195 | sources: [
196 | cdk.aws_s3_deployment.Source.asset(props.webSiteBuildPath), // Main webapp from root directory
197 | cdk.aws_s3_deployment.Source.jsonData("config.json", amplifyConfig), // Amplify config file
at new AssetStaging (node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2221)
at new Asset (node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:1243)
at Object.bind (node_modules/aws-cdk-lib/aws-s3-deployment/lib/source.js:1:1562)
at node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3870
at Array.map (<anonymous>)
at new BucketDeployment (node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3851)
at new CloudFrontS3WebSiteConstruct (lib/constructs/cloudfront-s3-website-construct.ts:194:5)
at new BedrockKbAgentStack (lib/bedrock-kb-agent-stack.ts:35:21)
at Object.<anonymous> (test/bedrock-kb-agent-stack.test.ts:12:13)
● BedrockKbAgentStack › At least one IAM policy includes required Bedrock permissions
Cannot find asset at /home/runner/work/aws-cdk-examples/aws-cdk-examples/typescript/bedrock-kb-agent/web-app/dist
192 | }
193 |
> 194 | new cdk.aws_s3_deployment.BucketDeployment(this, "DeployWithInvalidation", {
| ^
195 | sources: [
196 | cdk.aws_s3_deployment.Source.asset(props.webSiteBuildPath), // Main webapp from root directory
197 | cdk.aws_s3_deployment.Source.jsonData("config.json", amplifyConfig), // Amplify config file
at new AssetStaging (node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2221)
at new Asset (node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:1243)
at Object.bind (node_modules/aws-cdk-lib/aws-s3-deployment/lib/source.js:1:1562)
at node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3870
at Array.map (<anonymous>)
at new BucketDeployment (node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3851)
at new CloudFrontS3WebSiteConstruct (lib/constructs/cloudfront-s3-website-construct.ts:194:5)
at new BedrockKbAgentStack (lib/bedrock-kb-agent-stack.ts:35:21)
at Object.<anonymous> (test/bedrock-kb-agent-stack.test.ts:12:13)
● BedrockKbAgentStack › S3 bucket for knowledge base is created
Cannot find asset at /home/runner/work/aws-cdk-examples/aws-cdk-examples/typescript/bedrock-kb-agent/web-app/dist
192 | }
193 |
> 194 | new cdk.aws_s3_deployment.BucketDeployment(this, "DeployWithInvalidation", {
| ^
195 | sources: [
196 | cdk.aws_s3_deployment.Source.asset(props.webSiteBuildPath), // Main webapp from root directory
197 | cdk.aws_s3_deployment.Source.jsonData("config.json", amplifyConfig), // Amplify config file
at new AssetStaging (node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2221)
at new Asset (node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:1243)
at Object.bind (node_modules/aws-cdk-lib/aws-s3-deployment/lib/source.js:1:1562)
at node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3870
at Array.map (<anonymous>)
at new BucketDeployment (node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3851)
at new CloudFrontS3WebSiteConstruct (lib/constructs/cloudfront-s3-website-construct.ts:194:5)
at new BedrockKbAgentStack (lib/bedrock-kb-agent-stack.ts:35:21)
at Object.<anonymous> (test/bedrock-kb-agent-stack.test.ts:12:13)
● BedrockKbAgentStack › Bedrock Knowledge Base is created
Cannot find asset at /home/runner/work/aws-cdk-examples/aws-cdk-examples/typescript/bedrock-kb-agent/web-app/dist
192 | }
193 |
> 194 | new cdk.aws_s3_deployment.BucketDeployment(this, "DeployWithInvalidation", {
| ^
195 | sources: [
196 | cdk.aws_s3_deployment.Source.asset(props.webSiteBuildPath), // Main webapp from root directory
197 | cdk.aws_s3_deployment.Source.jsonData("config.json", amplifyConfig), // Amplify config file
at new AssetStaging (node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2221)
at new Asset (node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:1243)
at Object.bind (node_modules/aws-cdk-lib/aws-s3-deployment/lib/source.js:1:1562)
at node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3870
at Array.map (<anonymous>)
at new BucketDeployment (node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3851)
at new CloudFrontS3WebSiteConstruct (lib/constructs/cloudfront-s3-website-construct.ts:194:5)
at new BedrockKbAgentStack (lib/bedrock-kb-agent-stack.ts:35:21)
at Object.<anonymous> (test/bedrock-kb-agent-stack.test.ts:12:13)
● BedrockKbAgentStack › Bedrock Agent is created
Cannot find asset at /home/runner/work/aws-cdk-examples/aws-cdk-examples/typescript/bedrock-kb-agent/web-app/dist
192 | }
193 |
> 194 | new cdk.aws_s3_deployment.BucketDeployment(this, "DeployWithInvalidation", {
| ^
195 | sources: [
196 | cdk.aws_s3_deployment.Source.asset(props.webSiteBuildPath), // Main webapp from root directory
197 | cdk.aws_s3_deployment.Source.jsonData("config.json", amplifyConfig), // Amplify config file
at new AssetStaging (node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2221)
at new Asset (node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:1243)
at Object.bind (node_modules/aws-cdk-lib/aws-s3-deployment/lib/source.js:1:1562)
at node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3870
at Array.map (<anonymous>)
at new BucketDeployment (node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3851)
at new CloudFrontS3WebSiteConstruct (lib/constructs/cloudfront-s3-website-construct.ts:194:5)
at new BedrockKbAgentStack (lib/bedrock-kb-agent-stack.ts:35:21)
at Object.<anonymous> (test/bedrock-kb-agent-stack.test.ts:12:13)
● BedrockKbAgentStack › API Gateway routes are created
Cannot find asset at /home/runner/work/aws-cdk-examples/aws-cdk-examples/typescript/bedrock-kb-agent/web-app/dist
192 | }
193 |
> 194 | new cdk.aws_s3_deployment.BucketDeployment(this, "DeployWithInvalidation", {
| ^
195 | sources: [
196 | cdk.aws_s3_deployment.Source.asset(props.webSiteBuildPath), // Main webapp from root directory
197 | cdk.aws_s3_deployment.Source.jsonData("config.json", amplifyConfig), // Amplify config file
at new AssetStaging (node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2221)
at new Asset (node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:1243)
at Object.bind (node_modules/aws-cdk-lib/aws-s3-deployment/lib/source.js:1:1562)
at node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3870
at Array.map (<anonymous>)
at new BucketDeployment (node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3851)
at new CloudFrontS3WebSiteConstruct (lib/constructs/cloudfront-s3-website-construct.ts:194:5)
at new BedrockKbAgentStack (lib/bedrock-kb-agent-stack.ts:35:21)
at Object.<anonymous> (test/bedrock-kb-agent-stack.test.ts:12:13)
● BedrockKbAgentStack › Stack has the expected number of resources
Cannot find asset at /home/runner/work/aws-cdk-examples/aws-cdk-examples/typescript/bedrock-kb-agent/web-app/dist
192 | }
193 |
> 194 | new cdk.aws_s3_deployment.BucketDeployment(this, "DeployWithInvalidation", {
| ^
195 | sources: [
196 | cdk.aws_s3_deployment.Source.asset(props.webSiteBuildPath), // Main webapp from root directory
197 | cdk.aws_s3_deployment.Source.jsonData("config.json", amplifyConfig), // Amplify config file
at new AssetStaging (node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2221)
at new Asset (node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:1243)
at Object.bind (node_modules/aws-cdk-lib/aws-s3-deployment/lib/source.js:1:1562)
at node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3870
at Array.map (<anonymous>)
at new BucketDeployment (node_modules/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.js:1:3851)
at new CloudFrontS3WebSiteConstruct (lib/constructs/cloudfront-s3-website-construct.ts:194:5)
at new BedrockKbAgentStack (lib/bedrock-kb-agent-stack.ts:35:21)
at Object.<anonymous> (test/bedrock-kb-agent-stack.test.ts:12:13)
Test Suites: 1 failed, 1 total
Tests: 9 failed, 9 total
Snapshots: 0 total
Time: 8.508 s
Ran all test suites. |
Thx answer Michael, |
I add the missing dirs and run a test locally with a fresh checked branch, all tests are running .... PASS test/bedrock-kb-agent-stack.test.ts (272.977 s)a-powertools-3.4.0 aws_xray_sdk-2.14.0 botocore-1.35.91 jmespath-1.0.1 jsonpath_ng-1.7.0 ply-3.11 pydantic-2.10.4 pydantic-core-2.27.2 python-dateutil-2.9.0.post0 six-1.17.0 typing-extensions-4.12.2 ur Test Suites: 1 passed, 1 total |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
|
||
const cognito = new CognitoWebNativeConstruct(this, "Cognito", props); | ||
|
||
const webAppBuildPath = "./web-app/dist"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing.
Fixes #
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.