
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi everyone,
I wanted to ask for your help, as I've been trying to download a file from a presigned AWS S3 url using the WebRequest function, but with no success. I had successfully downloaded a file from another URL of a website I own without any problem, but when trying to do the same for the S3 url, with the same codebase, I get the 4002 error: ERR_WRONG_INTERNAL_PARAMETER - Wrong parameter in the inner call of the client terminal function.
The base of the URL is correctly added into Tools -> Options -> Expert Advisors -> Allow WebRequest for the listed URL (https://s3.eu-west-1.amazonaws.com).
The presigned S3 URL always starts with: https://s3.eu-west-1.amazonaws.com, and it then follows with the Bucket name, the route to the file, and then the presigned authorization. Here's an example: https://s3.eu-west-1.amazonaws.com/bucket-name/folder/file_name.csv?response-content-disposition=attachment%3B%20filename%3D%22file_name.csv%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=TJGHYHEHFDS8DIKJ....
As you can see, the presigned URL is quite long, but it is already correctly encoded. Also, as it is presigned, the request doesn't need any headers for authentication. You would just copy and paste it to your browser, and the file would start downloading.
I suspect it might be an HTTPS thing, as the documentation says that WebRequest sends an HTTP request, and AWS might be expecting an HTTPS. But on the other side, the URL for the test file I downloaded from my own site is also HTTPS, and the WebRequest worked just fine.
Here's the code I'm using, that worked for my own HTTPS site, but throws the 4002 error for the S3 url:
Does anyone know which might be the cause of the 4002 error?
Thank you in advance!
Best regards