Skip to content

Commit e879b71

Browse files
committed
Add user: '1000' to bundling parameters for Lambda functions
1 parent 522ce5a commit e879b71

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

typescript/postgres-lambda/lib/postgres-lambda-stack.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class PostgresLambdaStack extends cdk.Stack {
4646
'cp -r . /asset-output/'
4747
].join(' && ')
4848
],
49+
user: '1000',
4950
},
5051
}),
5152
vpc,
@@ -69,7 +70,20 @@ export class PostgresLambdaStack extends cdk.Stack {
6970
const postgresFunction = new lambda.Function(this, 'PostgresFunction', {
7071
runtime: lambda.Runtime.NODEJS_LATEST,
7172
handler: 'index.handler',
72-
code: lambda.Code.fromAsset(path.join(__dirname, '../lambda/postgres-to-lambda')),
73+
code: lambda.Code.fromAsset(path.join(__dirname, '../lambda/postgres-to-lambda'), {
74+
bundling: {
75+
image: cdk.DockerImage.fromRegistry('public.ecr.aws/sam/build-nodejs18.x'),
76+
command: [
77+
'bash', '-c', [
78+
'cp -r . /tmp',
79+
'cd /tmp',
80+
'npm init -y',
81+
'cp -r . /asset-output/'
82+
].join(' && ')
83+
],
84+
user: '1000',
85+
},
86+
}),
7387
environment: {
7488
FUNCTION_NAME: 'PostgresFunction',
7589
},
@@ -114,6 +128,7 @@ export class PostgresLambdaStack extends cdk.Stack {
114128
'cp -r . /asset-output/'
115129
].join(' && ')
116130
],
131+
user: '1000',
117132
},
118133
}),
119134
vpc,

0 commit comments

Comments
 (0)