-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Hi,
I'm not hugely experienced with react-native, so forgive me if I'm missing something obvious.
The following code works on iOS, but not on Android.
Notes: Removing the payload argument from pullParams, results in a missing key error
`AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'ident-pool-id',
Logins: {
'graph.facebook.com': accessToken
}
});
var lambda = new AWS.Lambda({region: 'eu-west-1', apiVersion: '2015-03-31'});
var pullParams = {
FunctionName : 'GetCustomerOrders',
InvocationType : 'RequestResponse',
LogType : 'None',
Payload: '{ "email" : "test@mail.com"}'
};
lambda.invoke(pullParams, function(error, data) {
if (error) {
console.log(error);
} else {
console.log(data);
// other code removed.
}
});
`
The error message
Error: Network Failure at XMLHttpRequest.<anonymous> (D:\Dev\TNM\node_modules\aws-sdk\dist\aws-sdk-react-native.js:25393) at XMLHttpRequest.dispatchEvent (D:\Dev\TNM\node_modules\event-target-shim\lib\event-target.js:172) at XMLHttpRequest.setReadyState (D:\Dev\TNM\node_modules\react-native\Libraries\Network\XMLHttpRequest.js:542) at XMLHttpRequest.__didCompleteResponse (D:\Dev\TNM\node_modules\react-native\Libraries\Network\XMLHttpRequest.js:378) at D:\Dev\TNM\node_modules\react-native\Libraries\Network\XMLHttpRequest.js:482 at RCTDeviceEventEmitter.emit (D:\Dev\TNM\node_modules\react-native\Libraries\EventEmitter\EventEmitter.js:181) at MessageQueue.__callFunction (D:\Dev\TNM\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:244) at D:\Dev\TNM\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108 at guard (D:\Dev\TNM\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:46) at MessageQueue.callFunctionReturnFlushedQueue (D:\Dev\TNM\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:107)
for reference, here is a snippet of my python lambda function:
`
def handler(event, context):
email = event['email']
# simplied for debugging purposes
return "test"
`