appleboy / lambda-action

GitHub Action for Deploying Lambda code to an existing function

Home Page:https://github.com/marketplace/actions/aws-lambda-deploy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

potential bug/issue ?

georgesjamous opened this issue · comments

I have a lambda that is fully deployed and in the ready state, however the action is not deploying and shows that the resource is in progress. However, a local cli (or cloud shell) shows the lambda is already in the active state.

I am not sure if this could be a caching issue in the action or something else, for now I will be using v0.1.5 as it proved to be working.

output from cloud shell:

> aws lambda get-function --function-name MY_FUNCTION_NAME
{
    "Configuration": {
        ....
        "RevisionId": "a3a78ff2-6188-4096-8e9b-ff0bc7cdad32",
        "State": "Active",
        "LastUpdateStatus": "Successful",
        ...

other versions:

In v0.1.9 the action is stuck waiting for Waiting Last Update Status to be successful.
In v0.1.6 the actions fails with The operation cannot be performed at this time. An update is in progress for resource
In v0.1.5 the action deploys successfully


I have included some logs for each version:

v0.1.5 (Succeeds)
the logs appear to be after updating the function, I am not sure, or if they are being ignored by the action.

023-04-19T14:07:11.8227695Z ##[command]/usr/bin/docker run .....
2023-04-19T14:07:13.6236493Z 2023/04/19 14:07:13 {
2023-04-19T14:07:13.6236980Z   CodeSha256: "RlBPDKKj3LIFDmpvFEjd9Jl+oXlZjkhYP0AbkSNcqo8=",
2023-04-19T14:07:13.6237351Z   CodeSize: 1286449,
2023-04-19T14:07:13.6237585Z   Description: "",
2023-04-19T14:07:13.6237811Z   Environment: {
2023-04-19T14:07:13.6238046Z     ....
2023-04-19T14:07:13.6243411Z   },
2023-04-19T14:07:13.6244440Z   FunctionArn: "arn:aws:lambda:***:0MY_ACCOUNT_ID0:function:MY_FUNCTION_NAME:5",
2023-04-19T14:07:13.6244856Z   FunctionName: "MY_FUNCTION_NAME",
2023-04-19T14:07:13.6245315Z   Handler: "index.handler",
2023-04-19T14:07:13.6245716Z   LastModified: "2023-04-19T14:07:13.000+0000",
2023-04-19T14:07:13.6246114Z   MemorySize: 128,
2023-04-19T14:07:13.6246352Z   PackageType: "Zip",
2023-04-19T14:07:13.6246995Z   RevisionId: "58a99a4b-f08f-4812-a86a-c4427790d89c",
2023-04-19T14:07:13.6247544Z   Role: "arn:aws:iam::0MY_ACCOUNT_ID0:role/lambda_MY_FUNCTION_NAME",
2023-04-19T14:07:13.6248264Z   Runtime: "nodejs18.x",
2023-04-19T14:07:13.6248521Z   State: "Pending",
2023-04-19T14:07:13.6248832Z   StateReason: "The function is being created.",
2023-04-19T14:07:13.6249849Z   StateReasonCode: "Creating",
2023-04-19T14:07:13.6250199Z   Timeout: 3,
2023-04-19T14:07:13.6250617Z   TracingConfig: {
2023-04-19T14:07:13.6250947Z     Mode: "PassThrough"
2023-04-19T14:07:13.6251453Z   },
2023-04-19T14:07:13.6251744Z   Version: "5"
2023-04-19T14:07:13.6252207Z }

v0.1.6 (Fails)

2023-04-19T14:10:43.2268523Z ##[command]/usr/bin/docker run ....
2023-04-19T14:10:44.3250985Z 2023/04/19 14:10:44 {
2023-04-19T14:10:44.3251855Z   Architectures: ["x86_64"],
2023-04-19T14:10:44.3252568Z   CodeSha256: "RlBPDKKj3LIFDmpvFEjd9Jl+oXlZjkhYP0AbkSNcqo8=",
2023-04-19T14:10:44.3253121Z   CodeSize: 1286449,
2023-04-19T14:10:44.3253499Z   Description: "",
2023-04-19T14:10:44.3253885Z   Environment: {
2023-04-19T14:10:44.3254246Z     Variables: <sensitive>
2023-04-19T14:10:44.3254577Z   },
2023-04-19T14:10:44.3255056Z   EphemeralStorage: {
2023-04-19T14:10:44.3255413Z     Size: 512
2023-04-19T14:10:44.3255908Z   },
2023-04-19T14:10:44.3256977Z   FunctionArn: "arn:aws:lambda:***:0MY_ACCOUNT_ID0:function:MY_FUNCTION_NAME",
2023-04-19T14:10:44.3257695Z   FunctionName: "MY_FUNCTION_NAME",
2023-04-19T14:10:44.3258398Z   Handler: "index.handler",
2023-04-19T14:10:44.3259308Z   LastModified: "2023-04-19T14:10:44.000+0000",
2023-04-19T14:10:44.3259835Z   LastUpdateStatus: "InProgress",
2023-04-19T14:10:44.3260493Z   LastUpdateStatusReason: "The function is being created.",
2023-04-19T14:10:44.3261045Z   LastUpdateStatusReasonCode: "Creating",
2023-04-19T14:10:44.3261391Z   MemorySize: 128,
2023-04-19T14:10:44.3261669Z   PackageType: "Zip",
2023-04-19T14:10:44.3262284Z   RevisionId: "9541e3f6-ee14-4570-90cc-e98aaa17d336",
2023-04-19T14:10:44.3263146Z   Role: "arn:aws:iam::0MY_ACCOUNT_ID0:role/lambda_MY_FUNCTION_NAME",
2023-04-19T14:10:44.3263644Z   Runtime: "nodejs18.x",
2023-04-19T14:10:44.3263939Z   RuntimeVersionConfig: {
2023-04-19T14:10:44.3265138Z     RuntimeVersionArn: "arn:aws:lambda:***::runtime:c869d752e4ae21a3945cfcb3c1ff2beb1f160d7bcec3b0a8ef7caceae73c055f"
2023-04-19T14:10:44.3265705Z   },
2023-04-19T14:10:44.3265957Z   SnapStart: {
2023-04-19T14:10:44.3266216Z     ApplyOn: "None",
2023-04-19T14:10:44.3266733Z     OptimizationStatus: "Off"
2023-04-19T14:10:44.3266979Z   },
2023-04-19T14:10:44.3267298Z   State: "Active",
2023-04-19T14:10:44.3267520Z   Timeout: 3,
2023-04-19T14:10:44.3267741Z   TracingConfig: {
2023-04-19T14:10:44.3268248Z     Mode: "PassThrough"
2023-04-19T14:10:44.3268489Z   },
2023-04-19T14:10:44.3268697Z   Version: "$LATEST"
2023-04-19T14:10:44.3269086Z }
2023-04-19T14:10:44.4646569Z 2023/04/19 14:10:44 ResourceConflictException: The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:***:0MY_ACCOUNT_ID0:function:MY_FUNCTION_NAME
2023-04-19T14:10:44.4647121Z {
2023-04-19T14:10:44.4647379Z   RespMetadata: {
2023-04-19T14:10:44.4647653Z     StatusCode: 409,
2023-04-19T14:10:44.4648126Z     RequestID: "28277a02-6dbe-406b-b441-0cd1bc8de66a"
2023-04-19T14:10:44.4648423Z   },
2023-04-19T14:10:44.4649236Z   Message_: "The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:***:0MY_ACCOUNT_ID0:function:MY_FUNCTION_NAME",
2023-04-19T14:10:44.4649720Z   Type: "User"
2023-04-19T14:10:44.4649962Z }
2023-04-19T14:10:44.4651016Z 2023/04/19 14:10:44 ResourceConflictException: The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:***:0MY_ACCOUNT_ID0:function:MY_FUNCTION_NAME
2023-04-19T14:10:44.4651512Z {
2023-04-19T14:10:44.4651748Z   RespMetadata: {
2023-04-19T14:10:44.4652013Z     StatusCode: 409,
2023-04-19T14:10:44.4652462Z     RequestID: "28277a02-6dbe-406b-b441-0cd1bc8de66a"
2023-04-19T14:10:44.4652749Z   },
2023-04-19T14:10:44.4653569Z   Message_: "The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:***:0MY_ACCOUNT_ID0:function:MY_FUNCTION_NAME",
2023-04-19T14:10:44.4654031Z   Type: "User"
2023-04-19T14:10:44.4654255Z }

v0.1.9 (Fails)

2023-04-19T14:00:54.4467101Z ##[group]Run appleboy/lambda-action@v0.1.9
2023-04-19T14:00:54.4467373Z with:
2023-04-19T14:00:54.4467679Z   aws_access_key_id: ***
2023-04-19T14:00:54.4468017Z   aws_secret_access_key: ***
2023-04-19T14:00:54.4468284Z   aws_region: ***
2023-04-19T14:00:54.4468546Z   function_name: MY_FUNCTION_NAME
2023-04-19T14:00:54.4468812Z   zip_file: bundle.zip
2023-04-19T14:00:54.4469040Z   debug: true
2023-04-19T14:00:54.4469259Z   publish: true
2023-04-19T14:00:54.4469476Z   memory_size: 0
2023-04-19T14:00:54.4469679Z   timeout: 0
2023-04-19T14:00:54.4469901Z   max_attempts: 600
2023-04-19T14:00:54.4470127Z ##[endgroup]
2023-04-19T14:00:54.4724364Z ##[command]/usr/bin/docker run ...
2023-04-19T14:00:55.1314597Z PRINT AT main.(*Plugin).dump(plugin.go:354)
2023-04-19T14:00:55.1315358Z []interface {} [ #len=1,cap=1
2023-04-19T14:00:55.1316462Z   main.Config {
2023-04-19T14:00:55.1318004Z     Region: string("***"), #len=9
2023-04-19T14:00:55.1318456Z     AccessKey: string("***"), #len=20
2023-04-19T14:00:55.1318889Z     SecretKey: string("***"), #len=40
2023-04-19T14:00:55.1319176Z     Profile: string(""), #len=0
2023-04-19T14:00:55.1319533Z     FunctionName: string("MY_FUNCTION_NAME"), #len=23
2023-04-19T14:00:55.1319871Z     ReversionID: string(""), #len=0
2023-04-19T14:00:55.1320144Z     S3Bucket: string(""), #len=0
2023-04-19T14:00:55.1320400Z     S3Key: string(""), #len=0
2023-04-19T14:00:55.1320691Z     S3ObjectVersion: string(""), #len=0
2023-04-19T14:00:55.1325582Z     DryRun: bool(false),
2023-04-19T14:00:55.1326319Z     ZipFile: string("bundle.zip"), #len=10
2023-04-19T14:00:55.1326796Z     Source: []string [ #len=1,cap=1
2023-04-19T14:00:55.1327072Z       string(""), #len=0
2023-04-19T14:00:55.1327384Z     ],
2023-04-19T14:00:55.1327613Z     Debug: bool(true),
2023-04-19T14:00:55.1327929Z     Publish: bool(true),
2023-04-19T14:00:55.1328243Z     MemorySize: int64(0),
2023-04-19T14:00:55.1328874Z     Timeout: int64(0),
2023-04-19T14:00:55.1329214Z     Handler: string(""), #len=0
2023-04-19T14:00:55.1329517Z     Role: string(""), #len=0
2023-04-19T14:00:55.1329858Z     Runtime: string(""), #len=0
2023-04-19T14:00:55.1330219Z     Environment: []string [ #len=1,cap=1
2023-04-19T14:00:55.1334834Z       string(""), #len=0
2023-04-19T14:00:55.1335448Z     ],
2023-04-19T14:00:55.1354038Z     ImageURI: string(""), #len=0
2023-04-19T14:00:55.1354723Z     Subnets: []string [ #len=1,cap=1
2023-04-19T14:00:55.1355303Z       string(""), #len=0
2023-04-19T14:00:55.1355550Z     ],
2023-04-19T14:00:55.1355995Z     SecurityGroups: []string [ #len=0,cap=0
2023-04-19T14:00:55.1356267Z     ],
2023-04-19T14:00:55.1356538Z     Description: string(""), #len=0
2023-04-19T14:00:55.1356831Z     Layers: []string [ #len=1,cap=1
2023-04-19T14:00:55.1357085Z       string(""), #len=0
2023-04-19T14:00:55.1357304Z     ],
2023-04-19T14:00:55.1357556Z     SessionToken: string(""), #len=0
2023-04-19T14:00:55.1357847Z     TracingMode: string(""), #len=0
2023-04-19T14:00:55.1358119Z     MaxAttempts: int(600),
2023-04-19T14:00:55.1358343Z   },
2023-04-19T14:00:55.1358593Z ],
2023-04-19T14:00:55.1360812Z 2023/04/19 14:00:55 Update function configuration ...
2023-04-19T14:00:55.4286495Z 2023/04/19 14:00:55 Current State: Active
2023-04-19T14:00:55.4287224Z 2023/04/19 14:00:55 Last Update Status: Successful
2023-04-19T14:00:55.6315578Z 2023/04/19 14:00:55 Update function code ...
2023-04-19T14:00:55.6316272Z PRINT AT main.(*Plugin).dump(plugin.go:354)
2023-04-19T14:00:55.6316640Z []interface {} [ #len=1,cap=1
2023-04-19T14:00:55.6317005Z   &  lambda.FunctionConfiguration {
2023-04-19T14:00:55.6317316Z     _: struct {} {
2023-04-19T14:00:55.6317559Z     },
2023-04-19T14:00:55.6318266Z     Architectures: []*string [ #len=1,cap=1
2023-04-19T14:00:55.6318623Z       &      string("x86_64"), #len=6
2023-04-19T14:00:55.6318871Z     ],
2023-04-19T14:00:55.6319299Z     CodeSha256: &string("dDZZy8P11QnVpM1GJj+DX/nXurZrmvIMvuR99qMfKfk="), #len=44
2023-04-19T14:00:55.6319706Z     CodeSize: &int64(242),
2023-04-19T14:00:55.6320128Z     DeadLetterConfig: *lambda.DeadLetterConfig<nil>,
2023-04-19T14:00:55.6320516Z     Description: &string(""), #len=0
2023-04-19T14:00:55.6320906Z     Environment: &lambda.EnvironmentResponse {
2023-04-19T14:00:55.6321225Z       _: struct {} {
2023-04-19T14:00:55.6321470Z       },
2023-04-19T14:00:55.6321797Z       Error: *lambda.EnvironmentError<nil>,
2023-04-19T14:00:55.6322180Z       Variables: map[string]*string { #len=2
2023-04-19T14:00:55.6322529Z         ....
2023-04-19T14:00:55.6323277Z       },
2023-04-19T14:00:55.6323508Z     },
2023-04-19T14:00:55.6323856Z     EphemeralStorage: &lambda.EphemeralStorage {
2023-04-19T14:00:55.6324185Z       _: struct {} {
2023-04-19T14:00:55.6324426Z       },
2023-04-19T14:00:55.6324670Z       Size: &int64(512),
2023-04-19T14:00:55.6324963Z     },
2023-04-19T14:00:55.6325336Z     FileSystemConfigs: []*lambda.FileSystemConfig [ #len=0,cap=0
2023-04-19T14:00:55.6325662Z     ],
2023-04-19T14:00:55.6326533Z     FunctionArn: &string("arn:aws:lambda:***:00MY_ACCOUNT_ID00:function:MY_FUNCTION_NAME"), #len=70
2023-04-19T14:00:55.6327033Z     FunctionName: &string("MY_FUNCTION_NAME"), #len=23
2023-04-19T14:00:55.6327440Z     Handler: &string("index.handler"), #len=13
2023-04-19T14:00:55.6327884Z     ImageConfigResponse: *lambda.ImageConfigResponse<nil>,
2023-04-19T14:00:55.6328248Z     KMSKeyArn: *string<nil>,
2023-04-19T14:00:55.6328737Z     LastModified: &string("2023-04-19T14:00:55.000+0000"), #len=28
2023-04-19T14:00:55.6329159Z     LastUpdateStatus: &string("InProgress"), #len=10
2023-04-19T14:00:55.6329650Z     LastUpdateStatusReason: &string("The function is being created."), #len=30
2023-04-19T14:00:55.6330153Z     LastUpdateStatusReasonCode: &string("Creating"), #len=8
2023-04-19T14:00:55.6330565Z     Layers: []*lambda.Layer [ #len=0,cap=0
2023-04-19T14:00:55.6331021Z     ],
2023-04-19T14:00:55.6331263Z     MasterArn: *string<nil>,
2023-04-19T14:00:55.6331553Z     MemorySize: &int64(128),
2023-04-19T14:00:55.6331892Z     PackageType: &string("Zip"), #len=3
2023-04-19T14:00:55.6332465Z     RevisionId: &string("85fa013c-bf28-4bb0-a17d-5b0c302a6e51"), #len=36
2023-04-19T14:00:55.6333007Z     Role: &string("arn:aws:iam::00MY_ACCOUNT_ID00:role/lambda_MY_FUNCTION_NAME"), #len=61
2023-04-19T14:00:55.6333432Z     Runtime: &string("nodejs18.x"), #len=10
2023-04-19T14:00:55.6333857Z     RuntimeVersionConfig: &lambda.RuntimeVersionConfig {
2023-04-19T14:00:55.6334200Z       _: struct {} {
2023-04-19T14:00:55.6334444Z       },
2023-04-19T14:00:55.6334788Z       Error: *lambda.RuntimeVersionError<nil>,
2023-04-19T14:00:55.6335761Z       RuntimeVersionArn: &string("arn:aws:lambda:***::runtime:c869d752e4ae21a3945cfcb3c1........"), #len=98
2023-04-19T14:00:55.6336217Z     },
2023-04-19T14:00:55.6336503Z     SigningJobArn: *string<nil>,
2023-04-19T14:00:55.6336885Z     SigningProfileVersionArn: *string<nil>,
2023-04-19T14:00:55.6337272Z     SnapStart: &lambda.SnapStartResponse {
2023-04-19T14:00:55.6337582Z       _: struct {} {
2023-04-19T14:00:55.6337825Z       },
2023-04-19T14:00:55.6338123Z       ApplyOn: &string("None"), #len=4
2023-04-19T14:00:55.6338502Z       OptimizationStatus: &string("Off"), #len=3
2023-04-19T14:00:55.6338792Z     },
2023-04-19T14:00:55.6339077Z     State: &string("Active"), #len=6
2023-04-19T14:00:55.6339406Z     StateReason: *string<nil>,
2023-04-19T14:00:55.6339743Z     StateReasonCode: *string<nil>,
2023-04-19T14:00:55.6340026Z     Timeout: &int64(3),
2023-04-19T14:00:55.6340408Z     TracingConfig: &lambda.TracingConfigResponse {
2023-04-19T14:00:55.6340874Z       _: struct {} {
2023-04-19T14:00:55.6341123Z       },
2023-04-19T14:00:55.6341439Z       Mode: &string("PassThrough"), #len=11
2023-04-19T14:00:55.6341719Z     },
2023-04-19T14:00:55.6342007Z     Version: &string("$LATEST"), #len=7
2023-04-19T14:00:55.6342400Z     VpcConfig: *lambda.VpcConfigResponse<nil>,
2023-04-19T14:00:55.6342700Z   },
2023-04-19T14:00:55.6342927Z ],
2023-04-19T14:00:55.7027620Z 2023/04/19 14:00:55 Current State: Active
2023-04-19T14:00:55.7028056Z 2023/04/19 14:00:55 Last Update Status: InProgress
2023-04-19T14:00:55.7028511Z 2023/04/19 14:00:55 Last Update Status Reason: The function is being created.
2023-04-19T14:00:55.7029102Z 2023/04/19 14:00:55 Last Update Status ReasonCode: Creating
2023-04-19T14:00:55.7029545Z 2023/04/19 14:00:55 Waiting Last Update Status to be successful ...

for v0.1.9 why fails?

2023-04-19T14:00:55.7027620Z 2023/04/19 14:00:55 Current State: Active
2023-04-19T14:00:55.7028056Z 2023/04/19 14:00:55 Last Update Status: InProgress
2023-04-19T14:00:55.7028511Z 2023/04/19 14:00:55 Last Update Status Reason: The function is being created.
2023-04-19T14:00:55.7029102Z 2023/04/19 14:00:55 Last Update Status ReasonCode: Creating
2023-04-19T14:00:55.7029545Z 2023/04/19 14:00:55 Waiting for Last Update Status to be successful ...

Above are working messages.

In v0.1.9 the action is stuck waiting for Waiting Last Update Status to be successful.

I assumed the actions is waiting for the lambda's last update status to be active before updating the function.
However, from your comment I see that the function is being updated and the action is waiting for it to be ready.

But, the function is not being updated and this action is stuck waiting for Waiting for Last Update Status to be successful ... for a long time, without actually explicitly failing. (I am cancelling the run after a 5-10 minutes)


update:
I thought maybe I was acting fast, so i allowed it to run uninterrupted, however it is exceeding its own waiting time:

2023/04/21 10:54:21 Last Update Status ReasonCode: Creating
2023/04/21 10:54:21 Waiting Last Update Status to be successful ...
2023/04/21 11:04:31 ResourceNotReady: exceeded wait attempts
2023/04/21 11:04:31 ResourceNotReady: exceeded wait attempts

Resolved:

I apologize, it looks like I was missing "lambda:GetFunction" in the policy for the role deploying to the function.
I did not detect it before since I bought the only variable was the version of this actions, but I was mistaken.

Note: this permission was not needed in v0.1.5

Closing this ticket