Coder Social home page Coder Social logo

Comments (5)

russellwheatley avatar russellwheatley commented on August 27, 2024

Hi @uhbsksingh - one way to help us help you would be to try debugging on the cloud functions emulator.

What to do:

  1. Ensure it throws exception on emulator
  2. Narrow down what is causing the bug by removing a couple of properties at a time (presumably you will have to match it on the emulator and redeploy).
  3. At some point, it will be successful and you will be able to narrow down what property is causing the exception. That way, we can figure out if the bug is a FlutterFire issue, firebase-ios-sdk or perhaps a misconfiguration.

Let me know how it goes 🙏

from flutterfire.

uhbsksingh avatar uhbsksingh commented on August 27, 2024

Hi @russellwheatley, the function works in the emulator. I sent the request using Postman to the emulator.

As for the properties, I sent the same JSON object I sent using Postman in callable.call. I get an exception like this

flutter: error.code: unknown
flutter: error.details: {}
flutter: error.message: An error occurred

The JSON object sent in the following code is the same one I sent on the body of the request sent using Postman to the emulator. The request runs successfully in the emulator but the same JSON object is not working when I send from my Flutter app to the deployed function. This is my call from Flutter to the deployed function.

final response = await callable.call({
        "data": {
          "activeCollectionId": "cYcoK45wFyBradLyQbhU",
          "action": {
            "action": "Add allocated purchase",
            "user": {
              "appUserId": "Hj9OD16vUuQVM1rDh30iIdcKCfk2",
              "fName": "Abhishek",
              "lName": "Singh",
              "imagePath": "mh_img_user/aa1692187748018"
            },
            "note": null
          },
          "purchaseBillList": [
            {
              "billID": "test-6102024-1",
              "reference": 1,
              "partner": {
                "partnerId": "test",
                "name": "test",
                "imagePath": null
              },
              "info": {
                "billDateTime":
                    "Timestamp(seconds=1718005730, nanoseconds=349154000)",
                "dueDateTime":
                    "Timestamp(seconds=1718005730, nanoseconds=349154000)",
                "dateTime":
                    "Timestamp(seconds=1718005730, nanoseconds=349154000)",
                "currency": "NPR",
                "action": {
                  "action": "Add allocated purchase",
                  "user": {
                    "appUserId": "Hj9OD16vUuQVM1rDh30iIdcKCfk2",
                    "fName": "Abhishek",
                    "lName": "Singh",
                    "imagePath": "mh_img_user/aa1692187748018"
                  },
                  "note": null
                },
                "paymentTerm": null,
                "attachments": null,
                "tags": null
              },
              "item": {
                "itemId": "d2mFoM7U0VEVESSEosIu",
                "name": "test",
                "unit": {
                  "unitId": "pieces",
                  "abbreviation": "pcs",
                  "allowDecimal": false
                },
                "imagePaths": null
              },
              "quantity": 1.0,
              "rate": 2200.0,
              "tax": {}
            }
          ],
          "transferEntityDocumentID": "9INPot7vBE4qwtFbEhkY",
          "appliedQuantity": 1.0,
          "billItemImageMap": {"d2mFoM7U0VEVESSEosIu": null}
        }
      });

Is there any other way I can decode the error?

from flutterfire.

russellwheatley avatar russellwheatley commented on August 27, 2024

This is why I asked you to remove properties from the JSON object input (and removing use in emulated function) to see what is causing the exception. There might be an issue with properties being parsed. Might want to start with:

"billDateTime":
    "Timestamp(seconds=1718005730, nanoseconds=349154000)",
"dueDateTime":
    "Timestamp(seconds=1718005730, nanoseconds=349154000)",
"dateTime":
    "Timestamp(seconds=1718005730, nanoseconds=349154000)",

Keep on removing properties until it works, then you will know which properties are causing the exception as they will be the ones you last removed.

from flutterfire.

russellwheatley avatar russellwheatley commented on August 27, 2024

I just noticed this in your cloud function:

      } catch (exception) {
        throw new HttpsError("unknown", "An error occurred", exception);
      }

why don't you wrap this around the entirety of the cloud function code within the function? This is exactly the exception you're getting in your flutter code by the way.

from flutterfire.

google-oss-bot avatar google-oss-bot commented on August 27, 2024

Hey @uhbsksingh. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

from flutterfire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.