diff --git a/docs/core/logger.md b/docs/core/logger.md index 2c42ebcef3..d58920924e 100644 --- a/docs/core/logger.md +++ b/docs/core/logger.md @@ -96,9 +96,9 @@ This functionality will include the following keys in your structured logs: Key | Example ------------------------------------------------- | --------------------------------------------------------------------------------- **cold_start**: `bool` | `false` -**function_name** `string` | `shopping-cart-api-lambda-prod-eu-central-1` +**function_name** `string` | `shopping-cart-api-lambda-prod-eu-west-1` **function_memory_size**: `number` | `128` -**function_arn**: `string` | `arn:aws:lambda:eu-central-1:123456789012:function:shopping-cart-api-lambda-prod-eu-central-1` +**function_arn**: `string` | `arn:aws:lambda:eu-west-1:123456789012:function:shopping-cart-api-lambda-prod-eu-west-1` **function_request_id**: `string` | `c6af9ac6-7b61-11e6-9a41-93e812345678` === "Manual" @@ -165,10 +165,10 @@ In each case, the printed log will look like this: ```json hl_lines="2-6" { "cold_start": true, - "function_arn": "arn:aws:lambda:eu-central-1:123456789012:function:shopping-cart-api-lambda-prod-eu-central-1", + "function_arn": "arn:aws:lambda:eu-west-1:123456789012:function:shopping-cart-api-lambda-prod-eu-west-1", "function_memory_size": 128, "function_request_id": "c6af9ac6-7b61-11e6-9a41-93e812345678", - "function_name": "shopping-cart-api-lambda-prod-eu-central-1", + "function_name": "shopping-cart-api-lambda-prod-eu-west-1", "level": "INFO", "message": "This is an INFO log with some context", "service": "serverlessAirline", @@ -193,7 +193,7 @@ You can append additional persistent keys and values in the logs generated durin const logger = new Logger({ persistentLogAttributes: { aws_account_id: '123456789012', - aws_region: 'eu-central-1', + aws_region: 'eu-west-1', logger: { name: '@aws-lambda-powertools/logger', version: '0.0.1', @@ -204,7 +204,7 @@ You can append additional persistent keys and values in the logs generated durin // OR add persistent log keys to an existing Logger instance with the appendKeys method: // logger.appendKeys({ // aws_account_id: '123456789012', - // aws_region: 'eu-central-1', + // aws_region: 'eu-west-1', // logger: { // name: '@aws-lambda-powertools/logger', // version: '0.0.1', @@ -234,7 +234,7 @@ You can append additional persistent keys and values in the logs generated durin "timestamp": "2021-12-12T21:49:58.084Z", "xray_trace_id": "abcdef123456abcdef123456abcdef123456", "aws_account_id": "123456789012", - "aws_region": "eu-central-1", + "aws_region": "eu-west-1", "logger": { "name": "@aws-lambda-powertools/logger", "version": "0.0.1" @@ -247,7 +247,7 @@ You can append additional persistent keys and values in the logs generated durin "timestamp": "2021-12-12T21:49:58.088Z", "xray_trace_id": "abcdef123456abcdef123456abcdef123456", "aws_account_id": "123456789012", - "aws_region": "eu-central-1", + "aws_region": "eu-west-1", "logger": { "name": "@aws-lambda-powertools/logger", "version": "0.0.1" @@ -666,15 +666,15 @@ This is how the printed log would look: { "message": "This is an INFO log", "service": "serverlessAirline", - "awsRegion": "eu-central-1", + "awsRegion": "eu-west-1", "correlationIds": { "awsRequestId": "c6af9ac6-7b61-11e6-9a41-93e812345678", "xRayTraceId": "abcdef123456abcdef123456abcdef123456", "myCustomCorrelationId": "foo-bar-baz" }, "lambdaFunction": { - "name": "shopping-cart-api-lambda-prod-eu-central-1", - "arn": "arn:aws:lambda:eu-central-1:123456789012:function:shopping-cart-api-lambda-prod-eu-central-1", + "name": "shopping-cart-api-lambda-prod-eu-west-1", + "arn": "arn:aws:lambda:eu-west-1:123456789012:function:shopping-cart-api-lambda-prod-eu-west-1", "memoryLimitInMB": 128, "version": "$LATEST", "coldStart": true @@ -709,7 +709,7 @@ This is a Jest sample that provides the minimum information necessary for Logger memoryLimitInMB: '128', logGroupName: '/aws/lambda/foo-bar-function', logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e812345678', getRemainingTimeInMillis: () => 1234, done: () => console.log('Done!'), diff --git a/packages/commons/src/tests/resources/contexts/hello-world.ts b/packages/commons/src/tests/resources/contexts/hello-world.ts index 7a65af1b9c..006cae3089 100644 --- a/packages/commons/src/tests/resources/contexts/hello-world.ts +++ b/packages/commons/src/tests/resources/contexts/hello-world.ts @@ -7,7 +7,7 @@ const helloworldContext: Context = { memoryLimitInMB: '128', logGroupName: '/aws/lambda/foo-bar-function-123456abcdef', logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:Example', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:Example', awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e8deadbeef', getRemainingTimeInMillis: () => 1234, done: () => console.log('Done!'), diff --git a/packages/logger/examples/persistent-attributes.ts b/packages/logger/examples/persistent-attributes.ts index b7e9604179..1e01f38fe2 100644 --- a/packages/logger/examples/persistent-attributes.ts +++ b/packages/logger/examples/persistent-attributes.ts @@ -18,7 +18,7 @@ const lambdaHandler: Handler = async () => { // Add persistent log keys to an existing Logger instance: logger.appendKeys({ aws_account_id: '123456789012', - aws_region: 'eu-central-1', + aws_region: 'eu-west-1', logger: { name: powertool.name, version: powertool.version, diff --git a/packages/logger/package.json b/packages/logger/package.json index 90deb9ea88..2262b6bd03 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -16,7 +16,7 @@ "test:e2e:nodejs12x": "RUNTIME=nodejs12x jest --group=e2e/logger", "test:e2e:nodejs14x": "RUNTIME=nodejs14x jest --group=e2e/logger", "test:e2e": "concurrently \"npm:test:e2e:nodejs12x\" \"npm:test:e2e:nodejs14x\"", - "watch": "jest --watch", + "watch": "jest --watch --group=unit", "build": "tsc", "lint": "eslint --ext .ts --fix --no-error-on-unmatched-pattern src tests", "format": "eslint --fix --ext .ts --fix --no-error-on-unmatched-pattern src tests", diff --git a/packages/logger/tests/helpers/InvocationLogs.ts b/packages/logger/tests/helpers/InvocationLogs.ts index d732a10755..fab917ca8d 100644 --- a/packages/logger/tests/helpers/InvocationLogs.ts +++ b/packages/logger/tests/helpers/InvocationLogs.ts @@ -25,9 +25,9 @@ export class InvocationLogs { * In each log, each content is separated by '\t' * [ * 'START RequestId: c6af9ac6-7b61-11e6-9a41-93e812345678 Version: $LATEST', - * '2022-01-27T16:04:39.323Z\tc6af9ac6-7b61-11e6-9a41-93e812345678\tINFO\t{"cold_start":true,"function_arn":"arn:aws:lambda:eu-central-1:561912387782:function:loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_memory_size":128,"function_name":"loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_request_id":"7f586697-238a-4c3b-9250-a5f057c1119c","level":"INFO","message":"This is an INFO log with some context and persistent key","service":"logger-e2e-testing","timestamp":"2022-01-27T16:04:39.323Z","persistentKey":"works"}', - * '2022-01-27T16:04:39.323Z\tc6af9ac6-7b61-11e6-9a41-93e812345678\tINFO\t{"cold_start":true,"function_arn":"arn:aws:lambda:eu-central-1:561912387782:function:loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_memory_size":128,"function_name":"loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_request_id":"7f586697-238a-4c3b-9250-a5f057c1119c","level":"INFO","message":"This is an INFO log with some context","service":"logger-e2e-testing","timestamp":"2022-01-27T16:04:39.323Z","persistentKey":"works","additionalKey":"additionalValue"}', - * '2022-01-27T16:04:39.323Z\tc6af9ac6-7b61-11e6-9a41-93e812345678\tERROR\t{"cold_start":true,"function_arn":"arn:aws:lambda:eu-central-1:561912387782:function:loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_memory_size":128,"function_name":"loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_request_id":"7f586697-238a-4c3b-9250-a5f057c1119c","level":"ERROR","message":"There was an error","service":"logger-e2e-testing","timestamp":"2022-01-27T16:04:39.323Z","persistentKey":"works","error":{"name":"Error","location":"/var/task/index.js:2778","message":"you cannot prevent this","stack":"Error: you cannot prevent this\\n at testFunction (/var/task/index.js:2778:11)\\n at runRequest (/var/task/index.js:2314:36)"}}', + * '2022-01-27T16:04:39.323Z\tc6af9ac6-7b61-11e6-9a41-93e812345678\tINFO\t{"cold_start":true,"function_arn":"arn:aws:lambda:eu-west-1:561912387782:function:loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_memory_size":128,"function_name":"loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_request_id":"7f586697-238a-4c3b-9250-a5f057c1119c","level":"INFO","message":"This is an INFO log with some context and persistent key","service":"logger-e2e-testing","timestamp":"2022-01-27T16:04:39.323Z","persistentKey":"works"}', + * '2022-01-27T16:04:39.323Z\tc6af9ac6-7b61-11e6-9a41-93e812345678\tINFO\t{"cold_start":true,"function_arn":"arn:aws:lambda:eu-west-1:561912387782:function:loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_memory_size":128,"function_name":"loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_request_id":"7f586697-238a-4c3b-9250-a5f057c1119c","level":"INFO","message":"This is an INFO log with some context","service":"logger-e2e-testing","timestamp":"2022-01-27T16:04:39.323Z","persistentKey":"works","additionalKey":"additionalValue"}', + * '2022-01-27T16:04:39.323Z\tc6af9ac6-7b61-11e6-9a41-93e812345678\tERROR\t{"cold_start":true,"function_arn":"arn:aws:lambda:eu-west-1:561912387782:function:loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_memory_size":128,"function_name":"loggerMiddyStandardFeatures-c555a2ec-1121-4586-9c04-185ab36ea34c","function_request_id":"7f586697-238a-4c3b-9250-a5f057c1119c","level":"ERROR","message":"There was an error","service":"logger-e2e-testing","timestamp":"2022-01-27T16:04:39.323Z","persistentKey":"works","error":{"name":"Error","location":"/var/task/index.js:2778","message":"you cannot prevent this","stack":"Error: you cannot prevent this\\n at testFunction (/var/task/index.js:2778:11)\\n at runRequest (/var/task/index.js:2314:36)"}}', * 'END RequestId: c6af9ac6-7b61-11e6-9a41-93e812345678', * 'REPORT RequestId: c6af9ac6-7b61-11e6-9a41-93e812345678\tDuration: 2.16 ms\tBilled Duration: 3 ms\tMemory Size: 128 MB\tMax Memory Used: 57 MB\t', * ] diff --git a/packages/logger/tests/helpers/populateEnvironmentVariables.ts b/packages/logger/tests/helpers/populateEnvironmentVariables.ts index 97a9ddd44f..8355fb5711 100644 --- a/packages/logger/tests/helpers/populateEnvironmentVariables.ts +++ b/packages/logger/tests/helpers/populateEnvironmentVariables.ts @@ -2,7 +2,7 @@ process.env._X_AMZN_TRACE_ID = 'abcdef123456abcdef123456abcdef123456'; process.env.AWS_LAMBDA_FUNCTION_NAME = 'my-lambda-function'; process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE = '128'; -process.env.AWS_REGION = 'eu-central-1'; +process.env.AWS_REGION = 'eu-west-1'; // Powertools variables process.env.LOG_LEVEL = 'DEBUG'; diff --git a/packages/logger/tests/unit/Logger.test.ts b/packages/logger/tests/unit/Logger.test.ts index ed6d543627..087d7f0bf6 100644 --- a/packages/logger/tests/unit/Logger.test.ts +++ b/packages/logger/tests/unit/Logger.test.ts @@ -255,7 +255,7 @@ describe('Class: Logger', () => { expect(console[methodOfLogger]).toBeCalledTimes(1); expect(console[methodOfLogger]).toHaveBeenNthCalledWith(1, JSON.stringify({ cold_start: true, - function_arn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function', + function_arn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', function_memory_size: 128, function_name: 'foo-bar-function', function_request_id: 'c6af9ac6-7b61-11e6-9a41-93e812345678', @@ -368,7 +368,7 @@ describe('Class: Logger', () => { logLevel: 'DEBUG', persistentLogAttributes: { aws_account_id: '123456789012', - aws_region: 'eu-central-1', + aws_region: 'eu-west-1', }, }); @@ -386,7 +386,7 @@ describe('Class: Logger', () => { timestamp: '2016-06-20T12:08:10.000Z', xray_trace_id: 'abcdef123456abcdef123456abcdef123456', aws_account_id: '123456789012', - aws_region: 'eu-central-1', + aws_region: 'eu-west-1', })); }); @@ -446,7 +446,7 @@ describe('Class: Logger', () => { memoryLimitInMB: '128', logGroupName: '/aws/lambda/foo-bar-function-with-cold-start', logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function-with-cold-start', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function-with-cold-start', awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e812345678', getRemainingTimeInMillis: () => 1234, done: () => console.log('Done!'), @@ -477,14 +477,14 @@ describe('Class: Logger', () => { logsSampled: false, persistentLogAttributes: {}, powertoolLogData: { - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', lambdaContext: { awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e812345678', coldStart: true, functionName: 'foo-bar-function-with-cold-start', functionVersion: '$LATEST', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function-with-cold-start', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function-with-cold-start', memoryLimitInMB: 128, }, sampleRateValue: undefined, @@ -544,7 +544,7 @@ describe('Class: Logger', () => { // Act logger.appendKeys({ aws_account_id: '123456789012', - aws_region: 'eu-central-1', + aws_region: 'eu-west-1', logger: { name: 'aws-lambda-powertool-typescript', version: '0.2.4', @@ -555,7 +555,7 @@ describe('Class: Logger', () => { expect(logger).toEqual(expect.objectContaining({ persistentLogAttributes: { aws_account_id: '123456789012', - aws_region: 'eu-central-1', + aws_region: 'eu-west-1', logger: { name: 'aws-lambda-powertool-typescript', version: '0.2.4', @@ -708,7 +708,7 @@ describe('Class: Logger', () => { expect(console['info']).toBeCalledTimes(1); expect(console['info']).toHaveBeenNthCalledWith(1, JSON.stringify({ cold_start: true, - function_arn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function', + function_arn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', function_memory_size: 128, function_name: 'foo-bar-function', function_request_id: 'c6af9ac6-7b61-11e6-9a41-93e812345678', @@ -751,7 +751,7 @@ describe('Class: Logger', () => { })); expect(console['info']).toHaveBeenNthCalledWith(2, JSON.stringify({ cold_start: true, - function_arn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function', + function_arn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', function_memory_size: 128, function_name: 'foo-bar-function', function_request_id: 'c6af9ac6-7b61-11e6-9a41-93e812345678', @@ -798,7 +798,7 @@ describe('Class: Logger', () => { })); expect(console['info']).toHaveBeenNthCalledWith(2, JSON.stringify({ cold_start: true, - function_arn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function', + function_arn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', function_memory_size: 128, function_name: 'foo-bar-function', function_request_id: 'c6af9ac6-7b61-11e6-9a41-93e812345678', @@ -905,7 +905,7 @@ describe('Class: Logger', () => { logsSampled: false, persistentLogAttributes: {}, powertoolLogData: { - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', sampleRateValue: undefined, serviceName: 'hello-world', @@ -929,7 +929,7 @@ describe('Class: Logger', () => { extra: 'This is an attribute that will be logged only by the child logger', }, powertoolLogData: { - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', sampleRateValue: undefined, serviceName: 'hello-world', @@ -951,7 +951,7 @@ describe('Class: Logger', () => { logsSampled: true, persistentLogAttributes: {}, powertoolLogData: { - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', sampleRateValue: 1, serviceName: 'hello-world', @@ -973,7 +973,7 @@ describe('Class: Logger', () => { logsSampled: false, persistentLogAttributes: {}, powertoolLogData: { - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', sampleRateValue: undefined, serviceName: 'hello-world', diff --git a/packages/logger/tests/unit/formatter/PowertoolLogFormatter.test.ts b/packages/logger/tests/unit/formatter/PowertoolLogFormatter.test.ts index 4bd87ef1be..798ac5bb8c 100644 --- a/packages/logger/tests/unit/formatter/PowertoolLogFormatter.test.ts +++ b/packages/logger/tests/unit/formatter/PowertoolLogFormatter.test.ts @@ -25,7 +25,7 @@ describe('Class: PowertoolLogFormatter', () => { const formatter = new PowertoolLogFormatter(); const unformattedAttributes = { sampleRateValue: undefined, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', serviceName: 'hello-world', xRayTraceId: 'abcdef123456abcdef123456abcdef123456', @@ -59,7 +59,7 @@ describe('Class: PowertoolLogFormatter', () => { const formatter = new PowertoolLogFormatter(); const unformattedAttributes: UnformattedAttributes = { sampleRateValue: 0.25, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: 'prod', serviceName: 'hello-world', xRayTraceId: 'abcdef123456abcdef123456abcdef123456', @@ -72,7 +72,7 @@ describe('Class: PowertoolLogFormatter', () => { memoryLimitInMB: 123, functionVersion: '1.23.3', coldStart: true, - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:Example', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:Example', awsRequestId: 'abcdefg123456789', }, }; @@ -83,7 +83,7 @@ describe('Class: PowertoolLogFormatter', () => { // Assess expect(value).toEqual({ cold_start: true, - function_arn: 'arn:aws:lambda:eu-central-1:123456789012:function:Example', + function_arn: 'arn:aws:lambda:eu-west-1:123456789012:function:Example', function_memory_size: 123, function_name: 'my-lambda-function', function_request_id: 'abcdefg123456789', diff --git a/packages/logger/tests/unit/helpers.test.ts b/packages/logger/tests/unit/helpers.test.ts index 5ef8db8f6a..70747f3794 100644 --- a/packages/logger/tests/unit/helpers.test.ts +++ b/packages/logger/tests/unit/helpers.test.ts @@ -39,7 +39,7 @@ describe('Helper: createLogger function', () => { persistentLogAttributes: {}, powertoolLogData: { sampleRateValue: undefined, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', serviceName: 'hello-world', xRayTraceId: 'abcdef123456abcdef123456abcdef123456', @@ -88,7 +88,7 @@ describe('Helper: createLogger function', () => { awsAccountId: '123456789', }, powertoolLogData: { - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: 'prod', sampleRateValue: 1, serviceName: 'my-lambda-service', @@ -124,7 +124,7 @@ describe('Helper: createLogger function', () => { logsSampled: false, persistentLogAttributes: {}, powertoolLogData: { - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', sampleRateValue: undefined, serviceName: 'service_undefined', @@ -151,7 +151,7 @@ describe('Helper: createLogger function', () => { persistentLogAttributes: {}, powertoolLogData: { sampleRateValue: undefined, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', serviceName: 'hello-world', xRayTraceId: 'abcdef123456abcdef123456abcdef123456', @@ -180,7 +180,7 @@ describe('Helper: createLogger function', () => { persistentLogAttributes: {}, powertoolLogData: { sampleRateValue: undefined, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', serviceName: 'my-backend-service', xRayTraceId: 'abcdef123456abcdef123456abcdef123456', @@ -209,7 +209,7 @@ describe('Helper: createLogger function', () => { persistentLogAttributes: {}, powertoolLogData: { sampleRateValue: undefined, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', serviceName: 'hello-world', xRayTraceId: 'abcdef123456abcdef123456abcdef123456', @@ -246,7 +246,7 @@ describe('Helper: createLogger function', () => { logsSampled: false, persistentLogAttributes: {}, powertoolLogData: { - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', sampleRateValue: undefined, serviceName: 'hello-world', @@ -272,7 +272,7 @@ describe('Helper: createLogger function', () => { persistentLogAttributes: {}, powertoolLogData: { sampleRateValue: 1, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', serviceName: 'hello-world', xRayTraceId: 'abcdef123456abcdef123456abcdef123456', @@ -319,7 +319,7 @@ describe('Helper: createLogger function', () => { persistentLogAttributes: {}, powertoolLogData: { sampleRateValue: undefined, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: 'dev', serviceName: 'my-backend-service', xRayTraceId: 'abcdef123456abcdef123456abcdef123456', @@ -337,7 +337,7 @@ describe('Helper: createLogger function', () => { const loggerOptions:LoggerOptions = { persistentLogAttributes: { aws_account_id: '123456789012', - aws_region: 'eu-central-1', + aws_region: 'eu-west-1', logger: { name: 'aws-lambda-powertool-typescript', version: '0.2.4', @@ -354,7 +354,7 @@ describe('Helper: createLogger function', () => { logsSampled: false, persistentLogAttributes: { aws_account_id: '123456789012', - aws_region: 'eu-central-1', + aws_region: 'eu-west-1', logger: { name: 'aws-lambda-powertool-typescript', version: '0.2.4', @@ -362,7 +362,7 @@ describe('Helper: createLogger function', () => { }, powertoolLogData: { sampleRateValue: undefined, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', serviceName: 'hello-world', xRayTraceId: 'abcdef123456abcdef123456abcdef123456', @@ -391,7 +391,7 @@ describe('Helper: createLogger function', () => { persistentLogAttributes: {}, powertoolLogData: { sampleRateValue: undefined, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: 'dev', serviceName: 'hello-world', xRayTraceId: 'abcdef123456abcdef123456abcdef123456', diff --git a/packages/logger/tests/unit/middleware/middy.test.ts b/packages/logger/tests/unit/middleware/middy.test.ts index 4472b45527..1993bf288f 100644 --- a/packages/logger/tests/unit/middleware/middy.test.ts +++ b/packages/logger/tests/unit/middleware/middy.test.ts @@ -46,7 +46,7 @@ describe('Middy middleware', () => { memoryLimitInMB: '128', logGroupName: '/aws/lambda/foo-bar-function', logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', awsRequestId: awsRequestId, getRemainingTimeInMillis: () => 1234, done: () => console.log('Done!'), @@ -63,14 +63,14 @@ describe('Middy middleware', () => { persistentLogAttributes: {}, powertoolLogData: { sampleRateValue: undefined, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', lambdaContext: { awsRequestId: awsRequestId, coldStart: true, functionName: 'foo-bar-function', functionVersion: '$LATEST', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', memoryLimitInMB: 128, }, serviceName: 'hello-world', @@ -107,7 +107,7 @@ describe('Middy middleware', () => { memoryLimitInMB: '128', logGroupName: '/aws/lambda/foo-bar-function', logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', awsRequestId: awsRequestId, getRemainingTimeInMillis: () => 1234, done: () => console.log('Done!'), @@ -122,14 +122,14 @@ describe('Middy middleware', () => { const expectation = expect.objectContaining({ powertoolLogData: { sampleRateValue: undefined, - awsRegion: 'eu-central-1', + awsRegion: 'eu-west-1', environment: '', lambdaContext: { awsRequestId: awsRequestId, coldStart: true, functionName: 'foo-bar-function', functionVersion: '$LATEST', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', memoryLimitInMB: 128, }, serviceName: 'hello-world', diff --git a/packages/metrics/tests/unit/middleware/middy.test.ts b/packages/metrics/tests/unit/middleware/middy.test.ts index bd9385dd23..3d4bed94f6 100644 --- a/packages/metrics/tests/unit/middleware/middy.test.ts +++ b/packages/metrics/tests/unit/middleware/middy.test.ts @@ -35,7 +35,7 @@ describe('Middy middleware', () => { memoryLimitInMB: '128', logGroupName: '/aws/lambda/foo-bar-function', logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', awsRequestId: awsRequestId, getRemainingTimeInMillis: () => 1234, done: () => console.log('Done!'), @@ -87,7 +87,7 @@ describe('Middy middleware', () => { }; const metricsOptions: ExtraOptions = { throwOnEmptyMetrics: true, - defaultDimensions: { environment : 'prod', aws_region: 'eu-central-1' }, + defaultDimensions: { environment : 'prod', aws_region: 'eu-west-1' }, captureColdStartMetric: true }; const handler = middy(lambdaHandler).use(logMetrics(metrics, metricsOptions)); @@ -108,7 +108,7 @@ describe('Middy middleware', () => { }], }, 'environment': 'prod', - 'aws_region' : 'eu-central-1', + 'aws_region' : 'eu-west-1', 'service': 'orders', 'function_name': 'foo-bar-function', 'ColdStart': 1, @@ -125,7 +125,7 @@ describe('Middy middleware', () => { }], }, 'environment': 'prod', - 'aws_region' : 'eu-central-1', + 'aws_region' : 'eu-west-1', 'service': 'orders', 'successfulBooking': 1, })); diff --git a/packages/tracing/tests/unit/Tracer.test.ts b/packages/tracing/tests/unit/Tracer.test.ts index 51fef13172..b97e1e4d5a 100644 --- a/packages/tracing/tests/unit/Tracer.test.ts +++ b/packages/tracing/tests/unit/Tracer.test.ts @@ -31,7 +31,7 @@ describe('Class: Tracer', () => { memoryLimitInMB: '128', logGroupName: '/aws/lambda/foo-bar-function-123456abcdef', logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:Example', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:Example', awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e8deadbeef', getRemainingTimeInMillis: () => 1234, done: () => console.log('Done!'), diff --git a/packages/tracing/tests/unit/middy.test.ts b/packages/tracing/tests/unit/middy.test.ts index 5829ba25cd..fc1605c97c 100644 --- a/packages/tracing/tests/unit/middy.test.ts +++ b/packages/tracing/tests/unit/middy.test.ts @@ -23,7 +23,7 @@ describe('Middy middleware', () => { memoryLimitInMB: '128', logGroupName: '/aws/lambda/foo-bar-function-123456abcdef', logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:Example', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:Example', awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e8deadbeef', getRemainingTimeInMillis: () => 1234, done: () => console.log('Done!'), diff --git a/tests/resources/contexts/hello-world.ts b/tests/resources/contexts/hello-world.ts index 5f58475326..dbb23c366d 100644 --- a/tests/resources/contexts/hello-world.ts +++ b/tests/resources/contexts/hello-world.ts @@ -7,7 +7,7 @@ const context: Context = { memoryLimitInMB: '128', logGroupName: '/aws/lambda/foo-bar-function', logStreamName: '2021/03/09/[$LATEST]abcdef123456abcdef123456abcdef123456', - invokedFunctionArn: 'arn:aws:lambda:eu-central-1:123456789012:function:foo-bar-function', + invokedFunctionArn: 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', awsRequestId: 'c6af9ac6-7b61-11e6-9a41-93e812345678', getRemainingTimeInMillis: () => 1234, done: () => console.log('Done!'),