When you create a new access key with createAccessKey, it can take a few seconds for the credentials to propagate across AWS services. If you try to use the new credentials immediately, AWS might not recognize them yet. Adding a small delay before using the credentials usually solves this issue.
Make sure to validate Region, IAM User Permissions, BucketName are correct and the userName matches the IAM User