Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Define a base class for FunctionalService to set basic Lambda settings in the AW
```js
import { FunctionalService, aws } from 'functionly'

@aws({ type: 'nodejs16.x', memorySize: 512, timeout: 3 })
@aws({ type: 'nodejs20.x', memorySize: 512, timeout: 3 })
export class TodoService extends FunctionalService { }
```

Expand Down
2 changes: 1 addition & 1 deletion src/annotations/classes/aws/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CLASS_AWSMEMORYSIZEKEY, CLASS_AWSTIMEOUTKEY, CLASS_AWSRUNTIMEKEY } from
import { defineMetadata } from '../../metadata'

export const aws = (config: {
type?: 'nodejs12.x'|'nodejs16.x',
type?: 'nodejs16.x' | 'nodejs18.x' | 'nodejs20.x',
memorySize?: number,
timeout?: number
}) => (target: Function) => {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/serverless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default (api) => {

const def = serverless.functions[functionName] = {
handler: `${nameKey}.${serviceDefinition.exportName}`,
runtime: getMetadata(CLASS_AWSRUNTIMEKEY, serviceDefinition.service) || "nodejs16.x"
runtime: getMetadata(CLASS_AWSRUNTIMEKEY, serviceDefinition.service) || "nodejs20.x"
}

await executor({ context, name: 'funtionEnvironments', method: funtionEnvironments })
Expand Down
2 changes: 1 addition & 1 deletion src/cli/providers/cloudFormation/context/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export const lambdaResource = async (context) => {
Handler: serviceDefinition.handler,
MemorySize: serviceDefinition[CLASS_AWSMEMORYSIZEKEY] || getMetadata(CLASS_AWSMEMORYSIZEKEY, serviceDefinition.service),
Role: serviceDefinition[CLASS_ROLEKEY] || getMetadata(CLASS_ROLEKEY, serviceDefinition.service),
Runtime: serviceDefinition[CLASS_AWSRUNTIMEKEY] || getMetadata(CLASS_AWSRUNTIMEKEY, serviceDefinition.service) || "nodejs16.x",
Runtime: serviceDefinition[CLASS_AWSRUNTIMEKEY] || getMetadata(CLASS_AWSRUNTIMEKEY, serviceDefinition.service) || "nodejs20.x",
Timeout: serviceDefinition[CLASS_AWSTIMEOUTKEY] || getMetadata(CLASS_AWSTIMEOUTKEY, serviceDefinition.service),
Environment: {
Variables: serviceDefinition[CLASS_ENVIRONMENTKEY] || getMetadata(CLASS_ENVIRONMENTKEY, serviceDefinition.service)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/utilities/aws/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const createLambdaFunction = ExecuteStep.register('CreateLambdaFunction',
MemorySize: getMetadata(constants.CLASS_AWSMEMORYSIZEKEY, context.serviceDefinition.service),
Publish: true,
Role: getMetadata(constants.CLASS_ROLEKEY, context.serviceDefinition.service),
Runtime: getMetadata(constants.CLASS_AWSRUNTIMEKEY, context.serviceDefinition.service) || "nodejs16.x",
Runtime: getMetadata(constants.CLASS_AWSRUNTIMEKEY, context.serviceDefinition.service) || "nodejs20.x",
Timeout: getMetadata(constants.CLASS_AWSTIMEOUTKEY, context.serviceDefinition.service),
Environment: {
Variables: getMetadata(constants.CLASS_ENVIRONMENTKEY, context.serviceDefinition.service)
Expand Down Expand Up @@ -118,7 +118,7 @@ export const updateLambdaFunctionConfiguration = ExecuteStep.register('UpdateLam
Handler: context.serviceDefinition.handler,
MemorySize: getMetadata(constants.CLASS_AWSMEMORYSIZEKEY, context.serviceDefinition.service),
Role: getMetadata(constants.CLASS_ROLEKEY, context.serviceDefinition.service),
Runtime: getMetadata(constants.CLASS_AWSRUNTIMEKEY, context.serviceDefinition.service) || "nodejs16.x",
Runtime: getMetadata(constants.CLASS_AWSRUNTIMEKEY, context.serviceDefinition.service) || "nodejs20.x",
Timeout: getMetadata(constants.CLASS_AWSTIMEOUTKEY, context.serviceDefinition.service),
VpcConfig: {
}
Expand Down
8 changes: 4 additions & 4 deletions test/annotation.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1269,14 +1269,14 @@ describe('annotations', () => {
})
describe("aws", () => {
it("type", () => {
@aws({ type: 'nodejs16.x' })
@aws({ type: 'nodejs20.x' })
class RuntimeTestClass { }

const runtimeValue = getMetadata(CLASS_AWSRUNTIMEKEY, RuntimeTestClass)
const memoryValue = getMetadata(CLASS_AWSMEMORYSIZEKEY, RuntimeTestClass)
const timeoutValue = getMetadata(CLASS_AWSTIMEOUTKEY, RuntimeTestClass)

expect(runtimeValue).to.equal('nodejs16.x')
expect(runtimeValue).to.equal('nodejs20.x')
expect(memoryValue).to.undefined
expect(timeoutValue).to.undefined
})
Expand Down Expand Up @@ -1305,14 +1305,14 @@ describe('annotations', () => {
expect(timeoutValue).to.equal(3)
})
it("all", () => {
@aws({ type: 'nodejs16.x', memorySize: 100, timeout: 3 })
@aws({ type: 'nodejs20.x', memorySize: 100, timeout: 3 })
class RuntimeTestClass { }

const runtimeValue = getMetadata(CLASS_AWSRUNTIMEKEY, RuntimeTestClass)
const memoryValue = getMetadata(CLASS_AWSMEMORYSIZEKEY, RuntimeTestClass)
const timeoutValue = getMetadata(CLASS_AWSTIMEOUTKEY, RuntimeTestClass)

expect(runtimeValue).to.equal('nodejs16.x')
expect(runtimeValue).to.equal('nodejs20.x')
expect(memoryValue).to.equal(100)
expect(timeoutValue).to.equal(3)
})
Expand Down