Hi there, I wanted to use the local lambda option for testing things out locally before deployment and got a corrupted/invalid state with my lambda after upgrading from 3.2 to 3.4:
LocalStack version: 3.4.1.dev20240425063645
LocalStack Docker container id: 3310928911c6
LocalStack build date: 2024-04-25
LocalStack build git hash: c7494f2
2024-05-22T16:13:21.037 INFO --- [ MainThread] l.bootstrap.licensingv2 : Successfully requested and activated new license 0843xxxxxxxxx:pro 🔑✅
2024-05-22T16:13:21.470 INFO --- [ MainThread] l.p.snapshot.plugins : registering ON_STARTUP load strategy
2024-05-22T16:13:21.851 INFO --- [ MainThread] l.p.snapshot.plugins : registering SCHEDULED save strategy
2024-05-22T16:13:21.871 INFO --- [ MainThread] l.extensions.platform : loaded 0 extensions
2024-05-22T16:13:21.877 INFO --- [-functhread4] hypercorn.error : Running on https://0.0.0.0:4566 (CTRL + C to quit)
2024-05-22T16:13:21.877 INFO --- [-functhread4] hypercorn.error : Running on https://0.0.0.0:4566 (CTRL + C to quit)
2024-05-22T16:13:21.877 INFO --- [-functhread4] hypercorn.error : Running on https://0.0.0.0:443 (CTRL + C to quit)
2024-05-22T16:13:21.877 INFO --- [-functhread4] hypercorn.error : Running on https://0.0.0.0:443 (CTRL + C to quit)
Ready.
2024-05-22T16:13:23.492 INFO --- [ MainThread] l.p.snapshot.plugins : restoring state of all services on startup
2024-05-22T16:13:23.501 INFO --- [ MainThread] l.persistence.manager : Loading state for sts took 5 ms
2024-05-22T16:13:23.547 INFO --- [ MainThread] l.services.s3.v3.provider : Using /var/lib/localstack/state/s3 as storage path for s3 assets
2024-05-22T16:13:23.594 INFO --- [ MainThread] l.persistence.manager : Loading state for s3 took 89 ms
2024-05-22T16:13:24.808 INFO --- [ MainThread] l.persistence.manager : Loading state for dynamodb took 1214 ms
2024-05-22T16:13:24.854 WARN --- [ MainThread] l.s.lambda_.provider : Failed to restore function version arn:aws:lambda:us-east-1:000000000000:function:novelcrafter-local:$LATEST
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/services/lambda_/provider.py", line 259, in on_after_state_load
new_config = dataclasses.replace(fn_version.config, state=new_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dataclasses.py", line 1496, in replace
changes[f.name] = getattr(obj, f.name)
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'VersionFunctionConfiguration' object has no attribute 'logging_config'
2024-05-22T16:13:24.855 INFO --- [ MainThread] l.persistence.manager : Loading state for lambda took 47 ms
2024-05-22T16:14:16.666 INFO --- [ asgi_gw_0] localstack.request.http : OPTIONS /2015-03-31/functions/ => 204
2024-05-22T16:14:16.681 ERROR --- [ asgi_gw_0] l.aws.handlers.logging : exception during call chain: 'VersionFunctionConfiguration' object has no attribute 'logging_config'
2024-05-22T16:14:16.682 INFO --- [ asgi_gw_0] localstack.request.aws : AWS lambda.ListFunctions => 500 (InternalError)
2024-05-22T16:14:16.800 ERROR --- [ asgi_gw_0] l.aws.handlers.logging : exception during call chain: 'VersionFunctionConfiguration' object has no attribute 'logging_config'
2024-05-22T16:14:16.800 INFO --- [ asgi_gw_0] localstack.request.aws : AWS lambda.ListFunctions => 500 (InternalError)
2024-05-22T16:14:16.891 ERROR --- [ asgi_gw_0] l.aws.handlers.logging : exception during call chain: 'VersionFunctionConfiguration' object has no attribute 'logging_config'
2024-05-22T16:14:16.891 INFO --- [ asgi_gw_0] localstack.request.aws : AWS lambda.ListFunctions => 500 (InternalError)
2024-05-22T16:14:17.175 ERROR --- [ asgi_gw_0] l.aws.handlers.logging : exception during call chain: 'VersionFunctionConfiguration' object has no attribute 'logging_config'
2024-05-22T16:14:17.176 INFO --- [ asgi_gw_0] localstack.request.aws : AWS lambda.ListFunctions => 500 (InternalError)
This is how the lambda was created initially:
# awslocal lambda create-function \
--> function-name novelcrafter-local \
--runtime> nodejs20.x \
--zip-> file fileb://lambda.zip \
--handler> lambda.handler \
--> role arn:aws:iam::000000000000:role/lambda-role
{
"FunctionName": "novelcrafter-local",
"FunctionArn": "arn:aws:lambda:us-east-1:000000000000:function:novelcrafter-local",
"Runtime": "nodejs20.x",
"Role": "arn:aws:iam::000000000000:role/lambda-role",
"Handler": "lambda.handler",
"CodeSize": 1428529,
"Description": "",
"Timeout": 3,
"MemorySize": 128,
"LastModified": "2024-05-22T16:09:22.282351+0000",
"CodeSha256": "uvNOuLlLTKOO8BRwKDoYKnHDcpAQL34tvL6XLsAV+LI=",
"Version": "$LATEST",
"TracingConfig": {
"Mode": "PassThrough"
},
"RevisionId": "314a1516-97b6-4aba-a6cd-489f81a6b8fd",
"State": "Pending",
"StateReason": "The function is being created.",
"StateReasonCode": "Creating",
"PackageType": "Zip",
"Architectures": [
"x86_64"
],
"EphemeralStorage": {
"Size": 512
},
"SnapStart": {
"ApplyOn": "None",
"OptimizationStatus": "Off"
},
"RuntimeVersionConfig": {
"RuntimeVersionArn": "arn:aws:lambda:us-east-1::runtime:8eeff65f6809a3ce81507fe733fe09b835899b99481ba22fd75b5a7338290ec1"
}
}
# awslocal lambda create-function-url-config \
> --function-name novelcrafter-local \
> --auth-type NONE
{
"FunctionUrl": "http://jwohzmjpzrmghec6339uwpigwfc9zfkl.lambda-url.us-east-1.localhost.localstack.cloud:4566/",
"FunctionArn": "arn:aws:lambda:us-east-1:000000000000:function:novelcrafter-local",
"AuthType": "NONE",
"CreationTime": "2024-05-22T16:09:29.009957+0000"
}