Skip to content

Commit

Permalink
Merge branch 'main' into apiid-resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch committed Dec 2, 2024
2 parents 9ad666c + cfdc854 commit 9aff173
Show file tree
Hide file tree
Showing 50 changed files with 857 additions and 70 deletions.
5 changes: 5 additions & 0 deletions .changeset/fair-ghosts-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/backend-deployer': patch
---

handle cdk error mapping for more generic invalid credentials
5 changes: 5 additions & 0 deletions .changeset/five-comics-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/platform-core': patch
---

return amplify user error as it is from `AmplifyError.fromError`
8 changes: 8 additions & 0 deletions .changeset/forty-bulldogs-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@aws-amplify/backend-function': minor
'@aws-amplify/backend': minor
---

Add support to `@aws-amplify/backend-function` for Node 22

Add support to `@aws-amplify/backend-function` for Node 22, which is a [supported Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html#runtime-deprecation-levels) that was added in [`aws-cdk-lib/aws-lambda` version `2.168.0`](https://github.com/aws/aws-cdk/releases/tag/v2.168.0) on November 20th, 2024
20 changes: 20 additions & 0 deletions .changeset/new-rings-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
'@aws-amplify/backend-platform-test-stubs': patch
'@aws-amplify/backend-output-storage': patch
'@aws-amplify/integration-tests': patch
'@aws-amplify/backend-deployer': patch
'@aws-amplify/backend-function': patch
'@aws-amplify/schema-generator': patch
'@aws-amplify/backend-storage': patch
'@aws-amplify/auth-construct': patch
'@aws-amplify/ai-constructs': patch
'@aws-amplify/client-config': patch
'@aws-amplify/backend-auth': patch
'@aws-amplify/backend-data': patch
'@aws-amplify/plugin-types': patch
'@aws-amplify/backend-ai': patch
'@aws-amplify/backend': patch
'@aws-amplify/sandbox': patch
---

update aws-cdk lib to ^2.168.0
9 changes: 9 additions & 0 deletions .changeset/poor-moons-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@aws-amplify/ai-constructs': minor
'@aws-amplify/backend-ai': minor
'@aws-amplify/backend-function': minor
'@aws-amplify/backend': minor
'@aws-amplify/platform-core': minor
---

Add options to control log settings
5 changes: 5 additions & 0 deletions .changeset/poor-phones-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/backend-deployer': patch
---

extract generic cdk asset publish failures
73 changes: 39 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/ai-constructs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
/// <reference types="node" />

import { AIConversationOutput } from '@aws-amplify/backend-output-schemas';
import { ApplicationLogLevel } from 'aws-cdk-lib/aws-lambda';
import { BackendOutputStorageStrategy } from '@aws-amplify/plugin-types';
import * as bedrock from '@aws-sdk/client-bedrock-runtime';
import { Construct } from 'constructs';
import { FunctionResources } from '@aws-amplify/plugin-types';
import * as jsonSchemaToTypeScript from 'json-schema-to-ts';
import { ResourceProvider } from '@aws-amplify/plugin-types';
import { RetentionDays } from 'aws-cdk-lib/aws-logs';

declare namespace __export__conversation {
export {
Expand Down Expand Up @@ -55,6 +57,10 @@ type ConversationHandlerFunctionProps = {
region?: string;
}>;
memoryMB?: number;
logging?: {
level?: ApplicationLogLevel;
retention?: RetentionDays;
};
outputStorageStrategy?: BackendOutputStorageStrategy<AIConversationOutput>;
};

Expand Down
2 changes: 1 addition & 1 deletion packages/ai-constructs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"typescript": "^5.0.0"
},
"peerDependencies": {
"aws-cdk-lib": "^2.158.0",
"aws-cdk-lib": "^2.168.0",
"constructs": "^10.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { ConversationHandlerFunction } from './conversation_handler_construct';
import { Template } from 'aws-cdk-lib/assertions';
import path from 'path';
import { StackMetadataBackendOutputStorageStrategy } from '@aws-amplify/backend-output-storage';
import { ApplicationLogLevel } from 'aws-cdk-lib/aws-lambda';
import { RetentionDays } from 'aws-cdk-lib/aws-logs';

void describe('Conversation Handler Function construct', () => {
void it('creates handler with log group with JWT token redacting policy', () => {
Expand Down Expand Up @@ -284,4 +286,41 @@ void describe('Conversation Handler Function construct', () => {
}, new Error('memoryMB must be a whole number between 128 and 10240 inclusive'));
});
});

void describe('logging options', () => {
void it('sets log level', () => {
const app = new App();
const stack = new Stack(app);
new ConversationHandlerFunction(stack, 'conversationHandler', {
models: [],
logging: {
level: ApplicationLogLevel.DEBUG,
},
});
const template = Template.fromStack(stack);

template.hasResourceProperties('AWS::Lambda::Function', {
LoggingConfig: {
ApplicationLogLevel: 'DEBUG',
LogFormat: 'JSON',
},
});
});

void it('sets log retention', () => {
const app = new App();
const stack = new Stack(app);
new ConversationHandlerFunction(stack, 'conversationHandler', {
models: [],
logging: {
retention: RetentionDays.ONE_YEAR,
},
});
const template = Template.fromStack(stack);

template.hasResourceProperties('AWS::Logs::LogGroup', {
RetentionInDays: 365,
});
});
});
});
Loading

0 comments on commit 9aff173

Please sign in to comment.