I have a golang lambda (using https://github.com/aws/aws-sdk-go-v2) running inside an amazon al2023 docker container. I also have an amazon/dynamodb-local running as well. I can curl dynamo and run the aws cli against, everything works.
However, when I try to hit it from the local golang lambda code, I get a 404 error with some others wrapped inside:
DynamoDB: Query, https response error StatusCode: 404, RequestID: , deserialization failed, failed to decode response body, json: cannot unmarshal number into Go value of type dynamodb.protocolErrorInfo
It looks like it can’t reach dynamodb, but I have not been able to figure out why. The protocolErrorInfo
is only mentioned twice in the sdk, once in code generation, so I’m not to sure if the unmarshal error is significant or not.
Has anyone come across some similiar, or have any ideas what could be wrong. The lambda works perfectly deployed to aws, this is only happening locally. The local lambda also works hitting a dynamodb table in aws.
I am guessing it must have something to do with the config to hit the local table. Currently I am setting the BaseEndpoint value like this:
cfg.BaseEndpoint = &endpoint
dynamodbClient = dynamodb.NewFromConfig(cfg)
as mentioned here in the docs. I know there is WithEndpointResolver
, but this is deprecated.
I’m without a rubber duck at the moment and not sure which direction to go next, so any help is appreciated.