Getting lots of CloudKit errors (500) all of a sudden - cloudkit

Nearly everything my app does in CloudKit now returns this error:
<CKError 0x14ecff70: "Server Rejected Request" (15/2001); "Request failed with http status code 500">
(lldb) po [error userInfo]
{
CKDHTTPHeaders = {
Connection = close;
"Content-Length" = 0;
"X-Apple-Request-UUID" = "F8E4C91A-5F72-4792-9F13-BB5FBB10BA8E";
"X-Responding-Instance" = "ckdatabaseservice:32400203:mr11p24ic-ztbu11100101:8103:15B153:16274";
};
CKHTTPStatus = 500;
NSDebugDescription = "CKInternalErrorDomain: 2001";
NSLocalizedDescription = "Request failed with http status code 500";
NSUnderlyingError = "<CKError 0x14d5af70: \"Unknown Error\" (2001)>";
}
Any ideas why this could be happening? I'm tempted to blame it on temporary CloudKit server issues (which is how I would want to interpret an error 500)...but I don't know if that's appropriate.

This is a bug on the iCloud server that's affecting your container. I've grabbed logs from that request and the server team will clean up your container soon. In the meantime you can use a different container name for testing.
If you'd like to file a radar for this we can let you know when the container gets cleaned up.

Related

How to return error response to calling channel when TCP destination gives 'Connection refused'

I have this pattern:
channel ESANTE_MPI_CREATE_PATIENT_LISTENER (with a MLLP listener) calls channel ESANTE_MPI_CREATE_PATIENT that calls a TCP destination.
If connection cannot be done in the TCP destination inside ESANTE_MPI_CREATE_PATIENT then this channel reports an error for this destination:(ERROR: ConnectException: Connection refused (Connection refused))
The response transformer does not seem to be called (which is normal as there is no response).
I wonder how I can report the error back to the calling channel ESANTE_MPI_CREATE_PATIENT_LISTENER ?
PS: When tcp destination responds, then I use the response transformer to parse the received frame and create a response message (json error/ok) for the calling channel. Everything works fine here.
My question ends up with: How to trap a Connection refused in a TCP destination to create a response message.
I finally managed this by using the postprocessor script in ESANTE_MPI_CREATE_PATIENT to get the response of the connector and then force a message.
// fake error message prepared for connection refused.
// we put this as the response of the channel destination in order to force a understandable error message.
const sErrorMsg = {
status: "error",
error: "connection refused to eSanté MPI"
};
const TCP_CONNECTOR_ESANTE_MPI_RANK = 2; // WARNING: be sure to take the correct connector ID as displayed into destination.
const TCP_CONNECTOR_ESANTE_MPI_DNAME = 'd' + TCP_CONNECTOR_ESANTE_MPI_RANK; // WARNING: be sure to take the correct connector ID as displayed into destination.
/*
var cms = message.getConnectorMessages(); // returns message but as Immutable
responses. not what we want: we use responseMap instead.
var key = TCP_CONNECTOR_ESANTE_MPI_RANK;
logger.debug(" Response Data=" + cms.get(key).getResponseData());
logger.debug(" Response Data0=" + cms.get(key).getResponseError());
logger.debug(" Response Data1=" + cms.get(key).getResponseData().getError());
logger.debug(" Response Data2=" + cms.get(key).getResponseData().getMessage());
logger.debug(" Response Data3=" + cms.get(key).getResponseData().getStatusMessage());
logger.debug(" Response Data4=" + cms.get(key).getResponseData().getStatus());
*/
var responseMPI = responseMap.get(TCP_CONNECTOR_ESANTE_MPI_DNAME); // return a mutable reponse :-)
if (responseMPI.getStatus()=='ERROR' &&
responseMPI.getStatusMessage().startsWith('ConnectException: Connection refused')) {
// build a error message for this dedicated case
logger.error("connection refused detected");
responseMPI.setMessage(JSON.stringify(sErrorMsg)); // force the message to be responsed.
}
return;

Firebase Authentication with phoneNumber failed with Internal error

I want to use Firebase SMS Authentication with phone number.
I have already enabled push notification in my app setting and registered Firebase Apns authentication key as google document says.
However, after I sent phone number with country code, Xcode says,
Failed to receive remote notification to verify app identity within 5
second(s)
Error says as below:
error: Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred, print and inspect the error details for more information." UserInfo={error_name=ERROR_INTERNAL_ERROR, NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information., NSUnderlyingError=0x28329c8a0 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={
code = 500;
errors = (
{
domain = global;
message = "Internal error encountered.";
reason = backendError;
}
);
message = "Internal error encountered.";
status = INTERNAL;
}}}}
My code:
PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber, uiDelegate: nil) { verificationId, error in
if let error = error {
print("error: \(error)")
return
}
print("verificationId: \(verificationId!)")
UserDefaults.standard.set(verificationId, forKey: "authVerificationID")
self.goToSecondVC()
}
Any idea??

Stop query if there Is an error (Parse.com)

At the moment the app it crashing if there is no internet connection when running the query. How do I tell the query to stop if there is an error and prevent this?
Thanks
Error Below:
Error: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo=0x1702e0d80 {NSUnderlyingError=0x1742569e0 "The Internet connection appears to be offline.", NSErrorFailingURLStringKey=https://api.parse.com/2/find, NSErrorFailingURLKey=https://api.parse.com/2/find, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSLocalizedDescription=The Internet connection appears to be offline.} (Code: 100, Version: 1.2.21)
2014-12-01 20:36:39.257 AppName[5903:999805] Network connection failed. Making attempt 2 after sleeping for 1.546502 seconds.
In parse there you can handle errors for many things.
I think to stop a query if there is not internet connection you can use kPFErrorConnectionFailed
Ex.
var query = PFQuery()
query.findObjectsInBackgroundWithBlock{
(success:Bool!, error:NSError!)-> Void in
if (error == nil) {
//continue query
}
else{
if(error.code == kPFErrorConnectionFailed) {
//handle error
}
}
}

Intuit Reporting services (Balancesheet / profilt and loss)

i am using the following code to get the balancesheet and profilt and loss data from quickbooks.
OAuthRequestValidator oauth = new OAuthRequestValidator(accessToken, accessTokenSecret,
consumerKey, consumerSecret);
ServiceContext serviceContext = new ServiceContext(realmId, IntuitServicesType.QBO, oauth);
serviceContext.IppConfiguration.Message.Request.SerializationFormat =
Intuit.Ipp.Core.Configuration.SerializationFormat.Json;
ReportService reportService = new ReportService(serviceContext);
reportService.accounting_method = "Accrual";
reportService.start_date = "2014-01-01";
reportService.end_date = "2014-06-01";
Report report = reportService.ExecuteReport("BalanceSheet");
it compiles well, but when it runs it gives the following error.
"
**Ids service endpoint was not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Intuit.Ipp.Exception.EndpointNotFoundException: Ids service endpoint was not found.
Source Error:
Line 133: reportService.start_date = "2014-01-01";
Line 134: reportService.end_date = "2014-06-01";
Line 135: Report report = reportService.ExecuteReport("BalanceSheet");
Line 136:
Line 137:"**
Please use the correct date format YYYY-MM-DD.
Please use response format as JSON as xml is not supported. Your code will work then.
serviceContext.IppConfiguration.Message.Response.SerializationFormat = Intuit.Ipp.Core.Configuration.SerializationFormat.Json;

Is there a 23andMe oauth2 example for iPhone?

I'm trying to use oauth2 to get data from 23 and me, but keep getting "bad request" codes. This is my first time working with OAuth2 and I'm not sure what I'm doing wrong.
When I use AFOAuth2Client, I get error code 400:
AFOAuth2Client* oauthClient = [AFOAuth2Client clientWithBaseURL:[NSURL URLWithString:#"https://api.23andme.com/"] clientID:clientIDString secret:secretString];
[oauthClient authenticateUsingOAuthWithPath:#"/token/"
code:#"zzz"
redirectURI:#"myapp://callback/oauth"
scope:#"analyses"
success:^(AFOAuthCredential *credential)
{
NSLog(#"I have a token! %#", credential.accessToken);
[AFOAuthCredential storeCredential:credential withIdentifier:oauthClient.serviceProviderIdentifier];
}
failure:^(NSError *error) {
NSLog(#"Error: %#", error);
}];
The error block is hit with this message:
Error: Error Domain=com.alamofire.networking.error Code=-1011 "Expected status code in (200-299), got 400" UserInfo=0x1fda4f80 {NSErrorFailingURLKey=https://api.23andme.com/token/, NSLocalizedDescription=Expected status code in (200-299), got 400}
When I try GTMOauth2Sample, I get invalid_client error after the authorization screen dismisses.
What am I doing wrong?
You can try to use this client from 23andme https://github.com/23andMe/OAuth2Client (forked from https://github.com/nxtbgthng/OAuth2Client ) .
This is an OAuth2 library for Mac OS X & iOS (Cocoa & Cocoa touch).
Actually OAuth2.0 is a standard level protocol and most companies' OAuth2.0 service interface is standard too .