DEV Community

Jayant Raj Singh
Jayant Raj Singh

Posted on

Problem with google cloud function

I have a cloud function that I am using as a webhook.
Whenever it is receiving something in Hindi it changes it to question Marks '?'.
I've tested it in my local system, where it works fine.

Top comments (11)

Collapse
 
mikenikles profile image
Mike

Hey, could you share your cloud function code? I'll have a look if there's anything that stands out.

Also, are you using the same tool to send the webhook request when you test locally vs the deployed cloud function?

Feel free to message me directly too. We can troubleshoot and post the issue and solution here for others to learn from.

Collapse
 
webjayant profile image
Jayant Raj Singh

Hey Mike,
Thanks for the prompt response.
I am using postman for local testing
Below is the my cloud function

  exports.depalpurSurvey = functions
  .region("asia-south1")
  .https.onRequest((_request, _response) => {
    try {
      let hasOrders = _request.body.sectionFields.length !== 0 ? true : false;
      getAllFields(_request.body, hasOrders)
        .then(({ fields, orders }) => {
          fields["Id"] = _request.body.form.formId.toString();
          fields["Filled Date"] = _request.body.form.modifiedTime;
          fields["Filled By"] = _request.body.form.filledByName;
          fields["Modified By"] = _request.body.form.modifiedByName;
          fields["Modified Date"] = _request.body.form.modifiedTime;
          insertDepalpurSurveyData(fields, orders)
            .then((duplicate) => {
              console.log("DUPLICATE", duplicate);
              if (!duplicate) {
                insertToDepalpurSurveyAirtable(fields, orders)
                  .then((rec) => {
                    console.log("RECORDS", JSON.stringify(rec));
                    _response.send("success").status(200);
                  })
                  .catch((err) => {
                    _response.send(JSON.stringify(err)).status(500);
                  });
              }
            })
            .catch((err) => {
              _response.send(err).status(500);
            });
        })
        .catch((err) => {
          console.error("GET FIELDS ERROR", new Error(err));
        });
    } catch (err) {
      console.error("ORDER_TAKING_SQLINSERT_FAILED", new Error(err));
      _response.send(err).status(500);
    }
  });
Enter fullscreen mode Exit fullscreen mode
Collapse
 
webjayant profile image
Jayant Raj Singh

Request Data

{
    "form": {
        "formId": 36976427,
        "companyId": 4079,
        "formSpecId": 107536,
        "formStatus": 0,
        "filledBy": 71593,
        "modifiedBy": 71593,
        "assignTo": 71593,
        "createdTime": "2020-10-31T09:41:52Z",
        "modifiedTime": "2020-10-31T09:41:52Z",
        "deleted": false,
        "filledByName": "Jayant 8120256820",
        "modifiedByName": "Jayant 8120256820",
        "clientFormId": "1602766392822",
        "canShowEditBasedOnWorkflowCondition": false,
        "serverCreatedTime": "2020-10-31 09:42:02.0",
        "serverModifiedTime": "2020-10-31T09:42:11Z",
        "showEdit": false,
        "showDelete": false,
        "uniqueId": "3a06714c-441c-41e5-915f-faa5d4e2159f",
        "commited": true,
        "mediasCommitted": true,
        "stockStatus": -1,
        "forcePerformActivity": false,
        "draftForm": 0,
        "publicForm": false,
        "formProcessed": false,
        "workId": 0,
        "count": 0,
        "listUpdateStatus": -1,
        "appVersion": "5.0.78C",
        "createdTimeLTZ": "2020-10-31 09:41:52.0",
        "modifiedTimeLTZ": "2020-10-31 09:41:52.0"
    },
    "fields": [
        {
            "fieldId": 1252345390,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1486996,
            "fieldValue": "1234",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "1234",
            "fieldLabel": "Case Number",
            "uniqueId": "f193fc7d-6a73-42c3-ace9-356fe3e0a133",
            "identifier": 0,
            "fieldType": 1
        },
        {
            "fieldId": 1252345391,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1486997,
            "fieldValue": "1556592",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Onboarding",
            "externalId": "Onboarding",
            "fieldLabel": "Activity Type",
            "uniqueId": "4062e1c1-8110-4650-ba54-c95a325c38b9",
            "identifier": 0,
            "fieldType": 14
        },
        {
            "fieldId": 1252345392,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1486999,
            "fieldValue": "2020-10-31 09:31:31",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "2020-10-31 09:31:31",
            "fieldLabel": "1. Date and Time of Visit",
            "uniqueId": "a8b43ed3-b96e-45d5-8f75-2590d1eeb146",
            "identifier": 0,
            "fieldType": 19
        },
        {
            "fieldId": 1252345393,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487000,
            "fieldValue": "apni dukan",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "apni dukan",
            "fieldLabel": "2. दुकान का नाम",
            "uniqueId": "15c66faa-4d49-42c1-a95c-187f127ec796",
            "identifier": 0,
            "fieldType": 1
        },
        {
            "fieldId": 1252345394,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487001,
            "fieldValue": "ravan",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "ravan",
            "fieldLabel": "3. मालिक का नाम",
            "uniqueId": "6dd0c642-1973-46a6-8e67-48afa800968d",
            "identifier": 0,
            "fieldType": 1
        },
        {
            "fieldId": 1252345395,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487002,
            "fieldValue": "8784646488",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "8784646488",
            "fieldLabel": "4. मालिक का मोबाइल नंबर",
            "uniqueId": "5f1bb4fa-ef1a-4970-bae2-f566e1316709",
            "identifier": 0,
            "fieldType": 2
        },
        {
            "fieldId": 1252345396,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487003,
            "fieldValue": "9465781554",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "9465781554",
            "fieldLabel": "5. Alternate मोबाइल नंबर",
            "uniqueId": "1d5f233d-3fe6-4d5c-b583-9cb9f48d42f5",
            "identifier": 0,
            "fieldType": 2
        },
        {
            "fieldId": 1252345397,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487004,
            "fieldValue": "8754646421",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "8754646421",
            "fieldLabel": "6. Whatsapp नंबर",
            "uniqueId": "478c3cda-d106-49d7-bd3a-b591c216ed9a",
            "identifier": 0,
            "fieldType": 2
        },
        {
            "fieldId": 1252345398,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487005,
            "fieldValue": "677325",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Father",
            "fieldLabel": "6a. Shop Run By",
            "uniqueId": "4874b02c-15f2-4098-9ce8-3c056708a2a1",
            "identifier": 0,
            "fieldType": 6
        },
        {
            "fieldId": 1252345399,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487006,
            "fieldValue": "677334",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "5th",
            "fieldLabel": "7. Education Level",
            "uniqueId": "fc068d69-375d-44b4-80ea-ec22eb68d03a",
            "identifier": 0,
            "fieldType": 6
        },
        {
            "fieldId": 1252345400,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487008,
            "fieldValue": "677350",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "10-15 Yrs",
            "fieldLabel": "8. Owner Age",
            "uniqueId": "400849fe-1372-4f43-891b-830c4df3efa0",
            "identifier": 0,
            "fieldType": 5
        },
        {
            "fieldId": 1252345401,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487009,
            "fieldValue": "677361",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "4-7 Yrs",
            "fieldLabel": "9. इस जगह पर कितने समय से व्यापार कर रहे है?",
            "uniqueId": "fbc14dab-f14e-482e-894b-85236563b209",
            "identifier": 0,
            "fieldType": 5
        },
        {
            "fieldId": 1252345402,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487010,
            "fieldValue": "nehru nagar indore",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "nehru nagar indore",
            "fieldLabel": "9a. Full Address",
            "uniqueId": "083e5def-4b89-4cf3-b9a3-aad51d1eb699",
            "identifier": 0,
            "fieldType": 1
        },
        {
            "fieldId": 1252345403,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487011,
            "fieldValue": "1555950",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Hatod",
            "externalId": "Hatod",
            "fieldLabel": "10. Taluka Name",
            "uniqueId": "0f6b3f8f-007b-424d-8e29-294f225b685a",
            "identifier": 0,
            "fieldType": 14
        },
        {
            "fieldId": 1252345404,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487012,
            "fieldValue": "hatod",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "hatod",
            "fieldLabel": "10a. Other Taluka Name",
            "uniqueId": "be0ce0f9-3730-47b1-9833-01f58985feb3",
            "identifier": 0,
            "fieldType": 1
        },
        {
            "fieldId": 1252345405,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487013,
            "fieldValue": "1556162",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Karadiya",
            "externalId": "Karadiya",
            "fieldLabel": "11. Village Name",
            "uniqueId": "89616613-9917-481c-99a5-9ad6a24e1f7a",
            "identifier": 0,
            "fieldType": 14
        },
        {
            "fieldId": 1252345406,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487014,
            "fieldValue": "karadiya2",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "karadiya2",
            "fieldLabel": "11a. Other Village name",
            "uniqueId": "43aae22b-c79d-4e44-a70e-900eacd06690",
            "identifier": 0,
            "fieldType": 1
        },
        {
            "fieldId": 1252345407,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487015,
            "fieldValue": "677367",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Dewas",
            "fieldLabel": "12. District",
            "uniqueId": "8f637b59-4f4f-49d3-ba33-ec17369b297d",
            "identifier": 0,
            "fieldType": 5
        },
        {
            "fieldId": 1252345408,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487017,
            "fieldValue": "474020",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "474020",
            "fieldLabel": "13. Pincode",
            "uniqueId": "42f04ac7-3448-4846-b585-724bee1863f1",
            "identifier": 0,
            "fieldType": 2
        },
        {
            "fieldId": 1252345409,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487018,
            "fieldValue": "22.7455919,75.8933132",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "22.7455919,75.8933132",
            "fieldLabel": "14. GPS Location",
            "uniqueId": "28e1605d-f2c7-402a-b0fb-67ea2fea5fd6",
            "identifier": 0,
            "fieldType": 18
        },
        {
            "fieldId": 1252345410,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487021,
            "fieldValue": "hshscs",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "hshscs",
            "fieldLabel": "15a. Other category",
            "uniqueId": "3d002a02-e079-4c6d-aceb-57fa1dc021a1",
            "identifier": 0,
            "fieldType": 1
        },
        {
            "fieldId": 1252345411,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487022,
            "fieldValue": "1556489,1556491,1556492,1556493,1556494,1556495",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Clothing-Kids Wear,Clothing-Women Wear,Coaching,College,Computer Center,Diploma",
            "externalId": "Clothing-Kids Wear,Clothing-Women Wear,Coaching,College,Computer Center,Diploma",
            "fieldLabel": "15b. Sub Category of Shop",
            "uniqueId": "8eee95ff-5464-4a35-acbe-916a60d48c31",
            "identifier": 0,
            "fieldType": 17
        },
        {
            "fieldId": 1252345412,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487023,
            "fieldValue": "677370",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "A+",
            "fieldLabel": "16. Shop Class",
            "uniqueId": "73d7f46a-8d97-4244-876d-3ab4cbe1132c",
            "identifier": 0,
            "fieldType": 5
        },
        {
            "fieldId": 1252345413,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487024,
            "fieldValue": "677377",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Yes-Pepsi",
            "fieldLabel": "16a. Have fridge in the shop?",
            "uniqueId": "7522bd0a-13e5-4ec5-909b-922e615ecf8c",
            "identifier": 0,
            "fieldType": 6
        },
        {
            "fieldId": 1252345414,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487025,
            "fieldValue": "677384",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Tuesday",
            "fieldLabel": "16b. Shop Weekly Off",
            "uniqueId": "10bce035-b1e2-4b09-8913-c0bc0a2d2d5a",
            "identifier": 0,
            "fieldType": 5
        },
        {
            "fieldId": 1252345415,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487026,
            "fieldValue": "1555782",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Atta Chakki",
            "externalId": "Atta Chakki",
            "fieldLabel": "17. Kirana Subcategory",
            "uniqueId": "3528ce7e-dee0-4590-ab4a-b4c876e4be61",
            "identifier": 0,
            "fieldType": 17
        },
        {
            "fieldId": 1252345416,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487027,
            "fieldValue": "cocacola",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "cocacola",
            "fieldLabel": "17a. Other subcategory",
            "uniqueId": "207f0b3e-badd-4120-a99a-a5b31b3648ff",
            "identifier": 0,
            "fieldType": 1
        },
        {
            "fieldId": 1252345417,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487028,
            "fieldValue": "677390",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Rented",
            "fieldLabel": "18. Ownership of Shop",
            "uniqueId": "f3965693-f0c8-449a-9356-9ecb000f5fb8",
            "identifier": 0,
            "fieldType": 5
        },
        {
            "fieldId": 1252345418,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487029,
            "fieldValue": "1556523,1556561,1556570",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Amul,Asian Paints,Amway India",
            "externalId": "Amul,Asian Paints,Amway India",
            "fieldLabel": "18a. OEM Name",
            "uniqueId": "8f456d09-6070-4357-a93f-fff8ae412dec",
            "identifier": 0,
            "fieldType": 17
        },
        {
            "fieldId": 1252345419,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487031,
            "fieldValue": "677393,677394,677395,677397,677398",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Aakash,Aashirwad,All Out,Amul(Choclates),Anmol",
            "fieldLabel": "19. Van Visiting Outlet",
            "uniqueId": "97d6181b-f527-4ee8-aa41-56ae6602e5c1",
            "identifier": 0,
            "fieldType": 6
        },
        {
            "fieldId": 1252345420,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487033,
            "fieldValue": "677552,677553,677554,677555,677556,677557,677559,677560,677561",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Ashirvaad ata,B Natural,Bingo,Bingo Starter,Bingo No Rulz,Bounce,Candy man,Capstan,Choco eclairs",
            "fieldLabel": "19b. Availability of ITC products in store:",
            "uniqueId": "ea8a9932-8f27-416b-a2cd-d3ddec9bb46e",
            "identifier": 0,
            "fieldType": 6
        },
        {
            "fieldId": 1252345421,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487035,
            "fieldValue": "677585,677587,677588",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "b. online app से ऑर्डर करते है,d. इंदौर के मार्केट से लेते हैं,e. कंपनी का Executive आता है",
            "fieldLabel": "20. दुकान के लिए समान कहाँ से लाते है?",
            "uniqueId": "a9652af2-c6e2-4dff-a120-87dc4f614765",
            "identifier": 0,
            "fieldType": 6
        },
        {
            "fieldId": 1252345422,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487036,
            "fieldValue": "xyz",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "xyz",
            "fieldLabel": "21a. Company and Distributor name",
            "uniqueId": "c0c5996c-54fe-400b-8b4a-4007b9c3a779",
            "identifier": 0,
            "fieldType": 1
        },
        {
            "fieldId": 1252345423,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487039,
            "fieldValue": "true",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Yes",
            "fieldLabel": "22. आपको समान उधार मिलता है?",
            "uniqueId": "c62b5b30-18d6-4d1c-94d4-b1b257b9f2d5",
            "identifier": 0,
            "fieldType": 4
        },
        {
            "fieldId": 1252345424,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487040,
            "fieldValue": "677593",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "11-15 Days",
            "fieldLabel": "22a. कितने दिनो का credit मिलता है?",
            "uniqueId": "529932fb-61f5-4185-8646-5b9b565a66e6",
            "identifier": 0,
            "fieldType": 5
        },
        {
            "fieldId": 1252345425,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487041,
            "fieldValue": "677597,677598,677599,677600,677602",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "a. QR code से पेमेंट accept,b. UPI use करते हैं,c. Debit/credit card उपयोग करते हैं,d. पेमेंट ऐप्प उपयोग करते हैं।,f. Udaan",
            "fieldLabel": "23. आप डिजिटली क्या क्या करते है?",
            "uniqueId": "c6c4700f-ca33-4b1d-a6aa-5b4a377f29a3",
            "identifier": 0,
            "fieldType": 6
        },
        {
            "fieldId": 1252345426,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487044,
            "fieldValue": "500000",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "500000",
            "fieldLabel": "25. Monthly Sale of Store",
            "uniqueId": "07d99aab-bd56-45ed-88c1-cf62630f6fee",
            "identifier": 0,
            "fieldType": 1
        },
        {
            "fieldId": 1252345427,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487045,
            "fieldValue": "677614",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "b. Medium",
            "fieldLabel": "26. Diffculty in Dealing with Owner",
            "uniqueId": "47e35633-35d8-4312-a48e-867cde70acb9",
            "identifier": 0,
            "fieldType": 5
        },
        {
            "fieldId": 1252345428,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487046,
            "fieldValue": "677616",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "a. Branded",
            "fieldLabel": "27. Preference of Store",
            "uniqueId": "9ec195aa-c9e4-4d20-bf5d-b757cf3e3445",
            "identifier": 0,
            "fieldType": 6
        },
        {
            "fieldId": 1252345429,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487047,
            "fieldValue": "true",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "Yes",
            "fieldLabel": "28. Is Shop Board Available",
            "uniqueId": "ee75a3c0-bc2a-49c7-9a21-877201f11da7",
            "identifier": 0,
            "fieldType": 4
        },
        {
            "fieldId": 1252345430,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487048,
            "fieldValue": "25681594",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "25681594",
            "fieldLabel": "28a. Capture Shop Board Photo",
            "uniqueId": "42620133-ae10-474c-9544-6acc8ab2f0ab",
            "identifier": 0,
            "fieldType": 12
        },
        {
            "fieldId": 1252345431,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487049,
            "fieldValue": "25681595",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "25681595",
            "fieldLabel": "28b. Capture Full Shop Photo from a distance",
            "uniqueId": "948e8122-31da-4c00-8ebb-2b293892f7fc",
            "identifier": 0,
            "fieldType": 12
        },
        {
            "fieldId": 1252345432,
            "formId": 36976427,
            "formSpecId": 107536,
            "fieldSpecId": 1487050,
            "fieldValue": "25681596",
            "canIgnoreUpdate": 0,
            "fieldDisplayValue": "25681596",
            "fieldLabel": "28c. Capture Shop Photo With Products",
            "uniqueId": "96e23543-4111-4e5f-8cfb-96e5449a8df9",
            "identifier": 0,
            "fieldType": 12
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
mikenikles profile image
Mike

Thanks for that. The implementation of a few functions is missing, for example getAllFields. Before we dive into that, where do you see the question marks? In your database?

If you print one of the fieldLabel values that contains Hindi characters at the beginning of the cloud function, do you see ? too? What about after you call getAllFields?

Let's try to narrow down where the ? first appear, that will help us determine what causes it.

Thread Thread
 
webjayant profile image
Jayant Raj Singh

I found this question on stackoverflow

stackoverflow.com/questions/605618...

Thread Thread
 
webjayant profile image
Jayant Raj Singh

I logged _request.body at the start of the function.
Having the same problem.

Thread Thread
 
mikenikles profile image
Mike

Given that you have the same problem with the data you receive in the request body, this is likely an issue with how the sender encodes the data.

I wrote a very basic Cloud Function with the following code. (Note: you seem to use Firebase Functions, I didn't test that but don't expect that to be the cause of the problem you see):

exports.helloWorld = (req, res) => {
  let message = req.body.message;
  console.log(message);
  res.status(200).send(message);
};
Enter fullscreen mode Exit fullscreen mode

I called it with the following command from the terminal:

curl -v -X POST -d '{"message": "आप डिजिटली क्या क्या करते है"}' -H "Content-Type: application/json" https://your-cloud-function-url
Enter fullscreen mode Exit fullscreen mode

The log output is: dev-to-uploads.s3.amazonaws.com/i/...

Thread Thread
 
webjayant profile image
Jayant Raj Singh

Ok thanks..
I'll do some testing and will let you know

Thread Thread
 
mikenikles profile image
Mike

Try a most basic command with curl like in my example. Keep me posted, I'll see what I can do to help you troubleshoot this.

Thread Thread
 
webjayant profile image
Jayant Raj Singh

The problem was with the data I was receiving from webhook :D

Thread Thread
 
mikenikles profile image
Mike

Nice find, thanks for sharing. It makes sense given you already saw question marks when you logged the request body. Glad you've resolved that.