I'm using v3 version of the sdk on node v18.16.0.
In my apps.mjs, I used the following:
import { SSMClient, GetParameterCommand } from "@aws-sdk/client-ssm";
When executing sam local start-api --env-vars env.json --profile default
with a POST request. I am receiving the following error in the debug logs.
The docker spins up and is starts to listen, but once I make a POST request to the lambda endpoint, the following error occurs and you can see the debug logs below:
2023-10-12 13:59:58,259 | Reuse the created warm container for Lambda function 'TestWebhookFunction'
2023-10-12 13:59:58,265 | Lambda function 'TestWebhookFunction' is already running
2023-10-12 13:59:58,269 | Starting a timer for 10 seconds for function 'TestWebhookFunction'
START RequestId: 3944c01e-7b96-496f-8948-0870b7e77393 Version: $LATEST
END RequestId: 3944c01e-7b96-496f-8948-0870b7e77393
REPORT RequestId: 3944c01e-7b96-496f-8948-0870b7e77393 Duration: 2.37 ms Billed Duration: 3 ms Memory Size: 128 MB Max Memory Used: 128 MB
2023-10-12 13:59:58,284 | Failed to deserialize response from RIE, returning the raw response as is
2023-10-12 13:59:59,290 | Exception on /testwebhook [POST]
Traceback (most recent call last):
File "flask/app.py", line 2190, in wsgi_app
File "flask/app.py", line 1486, in full_dispatch_request
File "flask/app.py", line 1484, in full_dispatch_request
File "flask/app.py", line 1469, in dispatch_request
File "samcli/local/apigw/local_apigw_service.py", line 719, in _request_handler
File "samcli/local/apigw/local_apigw_service.py", line 612, in _invoke_lambda_function
File "samcli/commands/local/lib/local_lambda.py", line 144, in invoke
File "samcli/lib/telemetry/metric.py", line 324, in wrapped_func
File "samcli/local/lambdafn/runtime.py", line 201, in invoke
File "samcli/local/docker/container.py", line 368, in wait_for_result
File "samcli/lib/utils/stream_writer.py", line 35, in write_bytes
AttributeError: '_io.StringIO' object has no attribute 'buffer'
This error goes away if I comment out the import { SSMClient, GetParameterCommand } from "@aws-sdk/client-ssm";
.
Does anyone know why? I ran aws cli get-parameter locally and my default profile and was able to retrieve the values.