My client is dio in Flutter, and server is nodejs in Lamda

When client request to server, server just generate presigned url and response to client with presigned url

It worked fine, but sometimes generate long text like this

https://my_s3_bucket/temp314311.webp?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=XXXXXXXX%2F20200518%2Fap-northeast-2%2Fs3%2Faws4_request&X-Amz-Date=20200518T105132Z&X-Amz-Expires=300&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEIv%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDmFwLW5vcnRoZWFzdC0yIkcwRQIhAMwtau9ngq9pJDoNHlanjlOUbe6RzjQ1qnZ36a6T3gHyAiBp6CCWBiDgEh1k4dESiqyGsBB0Q0FM3IeKpi2FxH0SAyrXAQjU%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAEaDDIyMzYzNjczMDM2NCIMYmMmpZM91BvVoo6%2BKqsBroY5SNoILMym4iUZ5rNEF2JGLhHLlajpEiWQE%2F1pMOeGOVdVczLBFXaVx5mKCbQK6KfJlPXEP2zArV7yARQ1ticyRlbkYPPNcmppTZvFop5lets5kZX43ZDFd1MIojco8A6HuHbaRzh6Z40I0hYojQG%2FFJx1yjoeedi3KgfQcb%2FBfJK%2BEu8%2BzhDrN0ak2p9hQjvIZCE5kedQsUL9a%2BGNPnAhUqNf1ucuhTOcMLPRifYFOuAB0H0v1ORwGWmisg4pGyb0nCtwBYrDLZOTFWVYJVMidcx08mPpe9DrC8V%2F6%2BpgX8Ufz60yrbGCiB0CdObIQHFPsIATJ1dtuZ0anPbjGVNUYxrYnF%2FlzM2f9lDmhF6kO%2FFVrbAVIShiyjbXOJgcsUhCqt4gAHmc5ywve7UE0QTP3na3mX163xISYHs5RugAx7aitA4IHKuI22dZXjq5PODzYl9%2FYlzoG2%2F2P8McMJw228c1A6CoonjQVe039sL3IVURDdZhHA6RptkNgLUwXj8ubOD3zqs0nypi7xz4THWO5iI%3D&X-Amz-Signature=20dd8277587a3f040336b100847ac318566a3ce399f2018f969a630ff314ccf6&X-Amz-SignedHeaders=host%3Bx-amz-acl&x-amz-acl=public-read

and my uplaod is fail to 403

correctly url is

https://my_s3_bucket/temp314311.webp?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=XXXXXXXX%2F20200518%2Fap-northeast-2%2Fs3%2Faws4_request&X-Amz-Date=20200518T105412Z&X-Amz-Expires=300&X-Amz-Signature=7bac36910d8729d01407c787bcc26db7a2f7337eef1f69064511f63a93e22acb&X-Amz-SignedHeaders=host%3Bx-amz-acl&x-amz-acl=public-read

my server code snippet is

const url = s3.getSignedUrl('putObject', {
                    Bucket: 'mybucket',
                    Key: uploadKey,
                    ACL: 'public-read',
                    Expires: 300
                });

I'm not sure I think when it does not used for a long time, It make wrong url

It so confuse
I don't know exact reason,
My code is so simple and It normally worked fine but sometimes error


Solution 1: Taz

I fixed about permission of IAM