Cloud function httpRequest fails.

51 views
Skip to first unread message

Prasad Pawar

unread,
Nov 2, 2019, 8:38:17 AM11/2/19
to Back4App
I am trying to send FCM notifications directly via the firebase POST url. When i comment out the httpRequest block, the function executes properly.
When i uncomment the block, it starts to give me 'invalid function (141)' error on Android app.

The request works and delivers notification via postman.

Here's my cloud function:
const httpResponse = await Parse.Cloud.httpRequest(
          method: 'POST',
          headers: {
            'Content-Type': 'application/json;charset=utf-8',
            'Authorization': 'key='+fcm_key
          },
          body:{
            'data':{
              'key1': 'value1',
              'key2' : 'value2',
              'key3': 'value3',
              'key4': 'value4',
              'key5': 'value5',
              'key6': 'value6',
              'key7': oneParseObject.get('someColumnName')
            },
            'registration_ids': new Array(targetFcmToken)
          }
        );
        return 'Done with status code '+httpResponse.status;

This is supposed to be strait forward but i'm not able to get it to work. Any pointers will be appreciated!

Prasad Pawar

unread,
Nov 5, 2019, 2:15:34 AM11/5/19
to Back4App
Resolved: missing curly braces in the httpResponse method call.

nat...@back4app.com

unread,
Nov 6, 2019, 5:31:43 AM11/6/19
to Back4App
Hi Prasad,

thanks for sharing the solution =D

Good to know that this issue is solved!

Regards,
Natália.
Reply all
Reply to author
Forward
0 new messages