Error:
ERROR HERE: Optional(Error Domain=com.amazonaws.AWSJSONBuilderErrorDomain Code=4 "serialized object is neither a valid json Object nor NSData object: " UserInfo={NSLocalizedDescription=serialized object is neither a valid json Object nor NSData object: })
Code:
import AWSLambda
import Foundation
struct AWSHelper{
let lambda = AWSLambda.default()
let APPLICATION_NAME = "MYAPPNAME"
init(){
}
func getFunctionName(funcName: String) -> String{
return "\(funcName)_\(APPLICATION_NAME)"
}
func login(facebookID: String,cognitoID:String, callback:@escaping (Bool) -> Void){
let req: AWSLambdaInvocationRequest = AWSLambdaInvocationRequest();
req.invocationType = AWSLambdaInvocationType.requestResponse
req.payload = ["cognitoID" : cognitoID, "facebookID" : facebookID]
req.functionName = getFunctionName(funcName: "Login")
lambda.invoke(req) { (response: AWSLambdaInvocationResponse?,error: Error?) in
print("ERROR HERE: \(error)")
let payload = response?.payload
print("PAYLOAD HERE: \(payload)")
callback(true)
}
}
}
I have looked at my lambda logs and I can see that I am not even invoking the method. What is the issue I am facing? I have another suspicion that it might be cognito here: AWS Cognito integration swift3 Refresh provides ResourceNotFoundException
But I'm confused if I am able to get an identityID, what is going wrong?
Now I am thinking it might be my lambda invocation.