For creating Pre-signed URL programmatically using Apex, the following steps mentioned below are performed.
1)we have created a pre-signed URL on the object that is uploaded in s3 bucket from AWS Console . A
We have created a pre-signed URL in the console using the option mentioned in the above screenshot. The pattern of URL that is created is in the below format.
We followed the same pattern for creating Pre-signed URL Programmatically in Apex.
USER_DEBUG|[6]|DEBUG|---------------https://bucketname.s3.us-east-1.amazonaws.com/locationoffile?response-content-disposition=inline&X-Amz-Security-Token=IQoJb3JpZ2luX2VjELP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIQCJOPGHdvqWJ18xtc%2BTSPrDDL2GFdDMRhg1yz7yc9ceWQIgIsGU1Ck2Er2tAOK4kNyWt%2F6i%2FMmfDnJGpCjQZVvFYCgqkwMILBADGgwxMjcwMjM1NjE4MDAiDLeYQLg8%2BL2sYbJLdyrwAovr4WAHHvT7DxtXsSHEXr2dgPKF09RWubBnnrZbVCgrEY5ry%2Fs5psemq25f%2FS%2Bozos4VheIv8AXbVGSSpzSMV8mhN9mGXyxY0ckb4ExPV4gPB4IHpFigZ%2FLtfo2TUSeMRSoQFuyoECkm%2BmZJLOaJYjr4DoArtfkZ28QX0S6MjN2PkZv8OHddcgSwg%2BNoDCKGrGz9e2%2BhKmMOlbXbLS90ojlxHXPlUJgt%2Bx6V9WUV2sZchSTRvdvP7bCMfMfm7nubYZCK8jJhb4KEEBMZ4SVdjVyNW547NXguWJx2rd9gVyNemwoiXQW7juJ0tYpxG63jtL7AcjOyIvytv32MysKpJPWfOeaFQBMGZAMjkrzUZKP0a%2Fmb6qxpwEyScJ33zd3OdQaWaoqCF9foRjhUo6exxI%2FVkEZ7NphFHM8ksF2cR0vjY%2Bq8ujVFsa2HUiwUGZAeO2iRH0MOnX9XiodM69whh0HxLcmjAc7HdngMUth250BMI3t4KsGOqYByyzzVgwWPxPoZWy%2BAq1mtOiiESy9c29a3HF7btXW4DfYAF28Pu0Ph4xCHj3HnyGX4pAcyhRj9n2yyQLFN7WXns49rMrlmqS1T2CrdULDHW6IW0jyxlz47yJc5e01X6kC%2FffFya6hftDZCPe9lgboC81Lb1FnA0UdQSPqaJWj3uA%2FNei6JrxcEN6IjkhtiEL%2FdRq%2F2hzv07D%2BxAUYfrZ9VSmTkaoZbw%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20231212T134111Z&X-Amz-SignedHeaders=host&X-Amz-Expires=5000&X-Amz-Credential=ASIAR3EZRXREHIBITJGR%2F20231212%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=4b99afc9fa225ab210ba314c591bc724f77b3f7994cca815f110dff597223db0
we are getting KeyTooLong Error when we try to use the Pre-signed URL as the length of URL is more than 1024 Characters.
The Pre-signed URL that we created in the console is also more than 1024 characters and we can download the document if we pass that URL in the browser. But the same URL when we created programmatically, we are getting the above-mentioned Error.
Any suggestions for resolving the issue?
Expecting solution for the above mentioned issue