AWS SDK for iOS didFailWithError not called when exceptions are off - iphone

when I setup my S3 like that
#property (nonatomic, strong) S3TransferManager *tm;
.
.
[AmazonErrorHandler shouldNotThrowExceptions];
[AmazonLogger verboseLogging];
self.tm = [S3TransferManager new];
self.tm.s3 = self.s3;
self.tm.delegate = self;
and then use
request = .......
S3TransferOperation * op = [self.tm download:request];
when I fetch a file that exists on my S3 account, the callback gets called fine
-(void)request:(AmazonServiceRequest *)request didCompleteWithResponse:(AmazonServiceResponse *)response
but when I try to fetch a file that does not exits, the callback does not get called
-(void)request:(AmazonServiceRequest *)request didFailWithError:(NSError *)error
if I remove
// [AmazonErrorHandler shouldNotThrowExceptions];
then I have a different problem, the exception is thrown, but despite me having a proper #try..#catch block in place, the app crashes
#try {
.
.
.
S3TransferOperation * op = [self.tm download:request];
} #catch (AmazonServiceException *exception) {
NSLog(#"========================>[S3 Module] ERROR, Unable to download file : %#", exception.error);
return NUMBOOL(NO);
} #catch (NSException * exception) {
NSLog(#"*************************[S3 Module] ERROR, Unable to download file : %#", exception);
return NUMBOOL(NO);
}
this is the AWS SDK verbose log when exception throwing is disabled
[DEBUG] 2013-12-01 23:25:16.243 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|443|Begin Request: S3GetObjectMetadataRequest
[DEBUG] 2013-12-01 23:25:16.246 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client signS3Request:]|646|In SignURLRequest: String to Sign = [HEAD
[DEBUG] application/x-www-form-urlencoded; charset=utf-8
[DEBUG] Sun, 01 Dec 2013 21:25:16 GMT
[DEBUG] /hello-XXX/NDAb.pdf]
[DEBUG] 2013-12-01 23:25:16.247 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|462|HEAD https://hello-XXX.s3.amazonaws.com/NDAb.pdf?
[DEBUG] 2013-12-01 23:25:16.248 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|463|Request headers:
[DEBUG] 2013-12-01 23:25:16.249 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|466| Date: Sun, 01 Dec 2013 21:25:16 GMT
[DEBUG] 2013-12-01 23:25:16.250 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|466| Content-Length: 0
[DEBUG] 2013-12-01 23:25:16.250 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|466| Authorization: AWS AKXXXXXW3YSTRRZAR4JPA:XXXXSAWELv5xAAR/mxXXXXVVJ2tr=
[DEBUG] 2013-12-01 23:25:16.251 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|466| User-Agent: Transfer Manager, aws-sdk-iOS/1.7.0 iPhone-OS/7.0 en_US NE
[DEBUG] 2013-12-01 23:25:16.252 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|466| Content-Type: application/x-www-form-urlencoded; charset=utf-8
[DEBUG] 2013-12-01 23:25:16.252 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|466| Host: hello-XXXXX.s3.amazonaws.com
[DEBUG] 2013-12-01 23:25:16.253 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|468|Request body:
[DEBUG] 2013-12-01 23:25:16.254 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|470|
[DEBUG] 2013-12-01 23:25:17.840 Ti-AWS-S3[84675:a0b] S3Response.m|-[S3Response connectionDidFinishLoading:]|182|Response:
[DEBUG] 2013-12-01 23:25:17.841 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|521|Response Status Code : 404
[DEBUG] 2013-12-01 23:25:17.842 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|530|Request threw exception: AmazonServiceException { RequestId:(null), ErrorCode:(null), Message:(null) }
[DEBUG] 2013-12-01 23:25:17.842 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|532|HTTP: 404, S3 Error Code: (null)
[DEBUG] 2013-12-01 23:25:17.843 Ti-AWS-S3[84675:a0b] AmazonS3Client.m|-[AmazonS3Client invoke:]|534|Reason: (null)
as you can see, my callbacks are not fired.
is it something I am doing wrong? or is this a bug with the AWS SDK?

We released version 1.7.1 of the AWS SDK for iOS that includes a couple of fixes related to S3TransferManager, including the issue you noted here. You can read more about the other feature enhancements and bug fixes in the release note.

Related

Active-Active minio cluster sync data

https://docs.min.io/minio/baremetal/replication/enable-server-side-two-way-bucket-replication.html#required-permissions
I follow this guide, when I do "mc admin policy add". I got an err:
mc: <ERROR> Unable to add new policy: conditions are not supported for action s3:GetBucketVersioning.
Then I add '--debug':
mc: <DEBUG> PUT /minio/admin/v3/add-canned-policy?name=ReplicationRemoteUserPolicy.json HTTP/1.1
Host: xxxxx:xxx
User-Agent: MinIO (linux; amd64) madmin-go/0.0.1 mc/RELEASE.2022-07-06T14-54-36Z
Content-Length: 1328
Accept-Encoding: gzip
Authorization: AWS4-HMAC-SHA256 Credential=admin/20220707//s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Content-Sha256: 26a5f72146edcd356b967fb84a6b1407418205af1904f9408fd2e85b196c98d1
X-Amz-Date: 20220707T094030Z
mc: <DEBUG> HTTP/1.1 400 Bad Request
Content-Length: 237
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Content-Type: application/json
Date: Thu, 07 Jul 2022 09:40:19 GMT
Server: MinIO
Vary: Origin
X-Amz-Request-Id: 16FF82A1BB2425B5
X-Xss-Protection: 1; mode=block
{"Code":"XMinioMalformedIAMPolicy","Message":"conditions are not supported for action s3:GetBucketVersioning","Resource":"/minio/admin/v3/add-canned-policy","RequestId":"16FF82A1BB2425B5","HostId":"3473e3d7-6fef-4358-83e7-f7e333eb8675"}
mc: <DEBUG> Response Time: 3.844982ms
---------START-HTTP---------
PUT /minio/admin/v3/add-canned-policy?name=ReplicationRemoteUserPolicy.json HTTP/1.1
Host: xxxxx:xxxx
User-Agent: MinIO (linux; amd64) madmin-go/0.0.1 mc/RELEASE.2022-07-06T14-54-36Z
Content-Length: 1328
Accept-Encoding: gzip
Authorization: AWS4-HMAC-SHA256 Credential=admin/20220707//s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Content-Sha256: 26a5f72146edcd356b967fb84a6b1407418205af1904f9408fd2e85b196c98d1
X-Amz-Date: 20220707T094030Z
HTTP/1.1 400 Bad Request
Content-Length: 237
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Content-Type: application/json
Date: Thu, 07 Jul 2022 09:40:19 GMT
Server: MinIO
Vary: Origin
X-Amz-Request-Id: 16FF82A1BB2425B5
X-Xss-Protection: 1; mode=block
{"Code":"XMinioMalformedIAMPolicy","Message":"conditions are not supported for action s3:GetBucketVersioning","Resource":"/minio/admin/v3/add-canned-policy","RequestId":"16FF82A1BB2425B5","HostId":"3473e3d7-6fef-4358-83e7-f7e333eb8675"}
---------END-HTTP---------
mc: <ERROR> Unable to add new policy: conditions are not supported for action s3:GetBucketVersioning
(1) admin-policy-add.go:140 cmd.mainAdminPolicyAdd(..) Tags: [cluster202, ReplicationRemoteUserPolicy.json, /dev/stdin]
(0) admin-policy-add.go:140 cmd.mainAdminPolicyAdd(..)
Commit:81c4a5ad6ee4 | Release-Tag:RELEASE.2022-07-06T14-54-36Z | Host:clone-instance-testv3 | OS:linux | Arch:amd64 | Lang:go1.18.3 | Mem:3.3 MB/17 MB | Heap:3.3 MB/7.7 MB.
How can I fix this?
I used helm chart install minio cluster, the tag of docker images is :RELEASE.2021-02-14T04-01-33Z

RESTHeart Error When Trying To Load CSV Data

I try to load csv data by using:
given().
contentType("text/csv").
body("num,name,val\n1,dror,x\n2,amir,y").
when().
log ().
all ().
post("csv?db=restheart&coll=poi&id=0").
then().log().ifError()
I get status 400:
"message": "Content-Type request header must be 'text/csv'"
although the header seems right:
Content-Type=text/csv; charset=ISO-8859-1
full log following:
Request path: http://localhost:8080/csv?db=restheart&coll=poi&id=0
Proxy: <none>
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Multiparts: <none>
Headers: Accept=*/*
Content-Type=text/csv; charset=ISO-8859-1
Cookies: <none>
Body:
num,name,val
1,dror,x
2,amir,y
HTTP/1.1 400 Bad Request
Content-Encoding: gzip
X-Powered-By: restheart.org
Auth-Token-Location: /tokens/admin
Authentication-Info: nextnonce="moqjKcH05wkNMTU4NTk1NDY2OTEwNe2jU1Xuay1TK5O7rrmyiDA=",qop="auth",rspauth="d31b66e99f7dbb1c339b17741f9380c5",cnonce="f1843d31ec429268",nc=00000001
Access-Control-Expose-Headers: Location, ETag, X-Powered-By, Auth-Token, Auth-Token-Valid-Until, Auth-Token-Location
Date: Fri, 03 Apr 2020 22:57:49 GMT
Auth-Token: 16p0go30vzwa3ju0h839zn4wfnipcy914g56b5t0xkjh9yotxa
Connection: keep-alive
Access-Control-Allow-Origin: *
Auth-Token-Valid-Until: 2020-04-03T23:12:49.109466Z
Access-Control-Allow-Credentials: true
Content-Type: application/json
Content-Length: 142
{
"http status code": 400,
"http status description": "Bad Request",
"message": "Content-Type request header must be 'text/csv'",
"_links": {
"self": {
"href": "/csv"
}
}
}
Any idea what is going wrong?
I checked the code of the CsvLoader service (that handles the request) and it checks Content-Type to be exactly text/csv, so I think the problem is with the additional charset substring ; charset=ISO-8859-1
Force the Content-Type header to be exactly just text-cvs.
I also fixed this bug (see commit 47fa0821). Fix will be included in upcoming v5.0 release.

bluemix app push hangs after upload

command bx app push hangs after message "Done uploading" is shown.
I activated CF_TRACE env var, and the following request is made several times before failing with:
Error processing app files: Error uploading application.
Server error, status code: 502, error code: 0, message:
REQUEST: [2018-08-01T11:47:21-03:00]
GET /v2/jobs/5dc92acb-8573-422b-8a60-2e6b558dc26e HTTP/1.1
Host: api.ng.bluemix.net
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
Connection: close
Content-Type: application/json
User-Agent: go-cli 6.32.0+0191c33d9.2017-09-26 / linux
RESPONSE: [2018-08-01T11:47:21-03:00]
HTTP/1.1 200 OK
Connection: close
Content-Length: 270
Cache-Control: max-age=0, no-cache, no-store
Content-Type: application/json;charset=utf-8
Date: Wed, 01 Aug 2018 14:47:21 GMT
Expires: Wed, 01 Aug 2018 14:47:21 GMT
Pragma: no-cache
Server: nginx
X-Backside-Transport: OK OK
X-Content-Type-Options: nosniff
X-Global-Transaction-Id: 2574851421
{
"metadata": {
"guid": "5dc92acb-8573-422b-8a60-2e6b558dc26e",
"created_at": "2018-08-01T14:36:25Z",
"url": "/v2/jobs/5dc92acb-8573-422b-8a60-2e6b558dc26e"
},
"entity": {
"guid": "5dc92acb-8573-422b-8a60-2e6b558dc26e",
"status": "queued"
}
}
I noticed the status queued on the entity object. What that means ? What can I do?
EDIT:
There was a problem with the region my app was on. It was reported at: https://console.bluemix.net/status

Failed to parse SDKResponse from http_response

I implemented a webhook to conform to the Actions on Google Conversation Protocol. However, when I simulate an interaction through the Web Simulator, I get the following error:
{
"response": “action name isn’t responding right now. Try again soon.\n",
"audioResponse": "...",
"debugInfo": {
"sharedDebugInfo": [
{
"name": "ExecutionResponse",
"debugInfo": "Failed to parse SDKResponse from http_response: 'HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nTransfer-Encoding: chunked\r\nConnection: keep-alive\r\nDate: Sun, 11 Dec 2016 22:54:50 GMT\r\nServer: Server-Software/1.0\r\nGoogle-Assistant-API-Version: v1\r\nVary: Accept-Encoding\r\nContent-Encoding: gzip\r\nX-Cache: Miss from CDN\r\nVia: 1.1 cdn.example.net (CDN)\r\n\r\n{\"conversation_token\":null,\"expect_user_response\":false,\"expected_inputs\":[],\"final_response\":{\"speech_response\":{\"ssml\":null,\"text_to_speech\":\"Hello!\"}}}'"
}
]
}
}
The block inside the debugInfo field is:
Failed to parse SDKResponse from http_response: 'HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Date: Sun, 11 Dec 2016 22:54:50 GMT
Server: Server-Software/1.0
Google-Assistant-API-Version: v1
Vary: Accept-Encoding
Content-Encoding: gzip
X-Cache: Miss from CDN
Via: 1.1 cdn.example.net (CDN)
{\"conversation_token\":null,\"expect_user_response\":false,\"expected_inputs\":[],\"final_response\":{\"speech_response\":{\"ssml\":null,\"text_to_speech\":\"Hello!\"}}}'
Fields that have null values or empty arrays should be excluded. For example, since expect_user_response is false, the expected_inputs field should not be present in the output. Use the following instead:
{
"expect_user_response": false,
"final_response": {
"speech_response": {
"text_to_speech": "Hello!"
}
}
}

NSURLConnection didReceiveResponse not recognizing multiple MIME types

I am working on a webcam viewer, for these cams: http://www.canvision.net/support/pt300-cgi/GetData.htm
the data arrives like this:
HTTP/1.0 200 OK
Date: Wed, 19 Feb 2003 03:40:16 GMT
Server: WYM/1.0
Connection: close
Content-Type: multipart/x-mixed-replace;boundary=WINBONDBOUDARY
Last-Modified: Wed, 19 Feb 2003 03:40:16 GMT
Pragma: no-cache
Cache-Control: no-cache
Expires: 01 Jan 1970 00:00:00 GMT
--WINBONDBOUDARY
Content-Type: image/jpeg
--WINBONDBOUDARY
Content-Type: image/jpeg
These are my NSURLConnection Delegate methods:
- (void)connection:(NSURLConnection *)theConnection didReceiveData:(NSData *)data
{
[currentData appendData:data];
}
(void)connection:(NSURLConnection *)theConnection didReceiveResponse:(NSURLResponse *)response{
NSLog(#"response with mime: %# length:%i",[response MIMEType],[currentData length]);
if([[response MIMEType] isEqualToString:#"image/jpeg"] && [currentData length] != 0){
currentFrame = [UIImage imageWithData:currentData];
NSLog(#"valid frame");
[image setImage:currentFrame];
frameCounter++;
}
else {
NSLog(#"other data:%#",currentData);
}
currentFrame = nil;
if (currentData == receivedData1)//swap buffers
currentData = receivedData2;
else
currentData = receivedData1;
[currentData setLength:0];
[currentFrame release];
}
This all works fine, and the console output looks as you would expect:
[Session started at 2011-02-21 20:20:39 +0100.]
2011-02-21 20:20:43.237 MotionJPEG[16330:207] response with mime: multipart/x-mixed-replace length:0
2011-02-21 20:20:43.261 MotionJPEG[16330:207] other data:<>
2011-02-21 20:20:43.262 MotionJPEG[16330:207] response with mime: image/jpeg length:0
2011-02-21 20:20:43.263 MotionJPEG[16330:207] other data:<>
2011-02-21 20:20:43.340 MotionJPEG[16330:207] response with mime: image/jpeg length:4608
2011-02-21 20:20:43.340 MotionJPEG[16330:207] valid frame
2011-02-21 20:20:43.445 MotionJPEG[16330:207] response with mime: image/jpeg length:4600
2011-02-21 20:20:43.446 MotionJPEG[16330:207] valid frame
2011-02-21 20:20:43.544 MotionJPEG[16330:207] response with mime: image/jpeg length:4580
2011-02-21 20:20:43.545 MotionJPEG[16330:207] valid frame
However, the Cam supports another mode, where additional infos are embedded between the jpegs:
HTTP/1.0 200 OK
Date: Wed, 19 Feb 2003 03:40:16 GMT
Server: WYM/1.0
Connection: close
Content-Type: multipart/x-mixed-replace;boundary=WINBONDBOUDARY
Last-Modified: Wed, 19 Feb 2003 03:40:16 GMT
Pragma: no-cache
Cache-Control: no-cache
Expires: 01 Jan 1970 00:00:00 GMT
--WINBONDBOUDARY
Content-Type: image/jpeg
--WINBONDBOUDARY
Content-Type: text/plain
--WINBONDBOUDARY
Content-Type: image/jpeg
--WINBONDBOUDARY
Content-Type: text/plain
In this mode I would expect the code to work ok, and the text/plain part to be written to the console by the
NSLog(#"other data:%#",currentData);
line.
however, for some reason, the output looks exactly the same, and it never says response with mime: text/plain
instead, the plaintext part is appended to the jpeg, and UIImageView is unable to display the data.
Why does NSURLConnection not recognize the text/plain part?
Here is the complete source: http://renehopf.de/MotionJPEG.zip
but to reproduce the problem you would need the same webcam...
Thanks,
Rene