Open wsmartinpreddio opened 11 months ago
Hi @wsmartinpreddio - thanks for reaching out and sorry for the delay as issue reproduction took longer than expected.
I attempted to reproduce it multiple times but was unable to. To narrow down the root causes, can you verify the followings:
Also here's similar issue with different SDK reported on AWS community repost which you might find it useful.
If the issue persists, please share those info above and I'd be happy to investigate further. Best, John
Hi John,
Our lambdas are using the node docker image public.ecr.aws/lambda/nodejs:18-x86_64 and I'm using --external in my Dockerfile esbuild commands for the aws sdk to utilize the pre-bundled aws sdk.
That being said my package-lock.json has the @aws-sdk/client-iot-data-plane version at 3.451.0
Yes the exception does occur intermittently, we've only encountered it a handful of times and also had limited success being able to reproduce the error.
The iam policy is using 'iot' not 'iot-data' (see above for policy already provided) like in the re:post link you provided.
I provide permission for my lambda to connect using any client id, would there be any reason why making the iam policy more restrictive to a specific client id would be better than the already very broad permissions I grant the lambda?
Best,
Wade
Checkboxes for prior research
Describe the bug
I have a lambda function which publishes to a number of topics from a lambda function. We have encountered, on some rare occasions, a ForbiddenException being thrown when attempting to publish. 99 times out of 100 the publish command succeeds, the other 1% we encounter the below error:
We invoke this lambda via an http api gateway integration and provide permissions via an IAM role.
The iot-data plane client is instantiated outside the handler.
SDK version number
@aws-sdk/package-name@version, ...
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
node 18
Reproduction Steps
Lambda function running node 18, invoked from aws http api gateway v2 endpoint with lambda integration, instantiate iot data plane client outside handler function and use to send publish command(s) within handler.
Observed Behavior
occasional ForbiddenException thrown by iot data plane client
Expected Behavior
publish command succeeds without error
Possible Solution
No response
Additional Information/Context
No response