Home > database >  FirebaseFunctionsException: code: -1007, too many HTTP redirects
FirebaseFunctionsException: code: -1007, too many HTTP redirects

Time:01-04

I don't understand why I'm getting this error. It happens either on a virtual or real device. I try to uninstall the app and nothing change. Why a simple helloWord function throw this error. I have no console log displayed. In the log I have this message: "Request has invalid method. GET" then "Error: Invalid request, unable to process. at entryFromArgs..." Why redirect? Could it be related to the cloud region I change? How could I clean that. Thank you.

Below the cloud function.

exports.belleDiana = functions.region(CLOUD_REGION).https.onCall(async (data, context) : Promise<String> => {
    console.log("belleDiana", data, context);
    console.log("context.auth", context.auth?.uid, context);
    return "belleDianaDone";
});

The call on flutter side.

    try {
      final result =
      await FirebaseFunctions.instance.httpsCallable('belleDiana').call();
      print("result: $result");
    } on FirebaseFunctionsException catch (error) {
      print(error);
      print(error.code);
      print(error.details);
      print(error.message);
    }

CodePudding user response:

Request has invalid method. GET seems like the GET method that triggers your function is not supported. You can check what kind of methods that trigger your function by referring to this Documentation. And the HTTP request to a callable trigger endpoint must be a POST.

Could it be related to the cloud region I change?

It might be related to the region change also. Try to check whether the cloud function is configured properly to accept requests to the newly changed region. Or try to revert to the previous region, that may resolve the issue.

Also have a look at this thread1 & thread2 which might be helpful.

CodePudding user response:

I switch to the original region 'us-central1'. When I change cloud region I have this message " Unhandled error cleaning up build images. This could result in a small monthly bill if not corrected. You can attempt to delete these images by redeploying or you can delete them manually at https://console.cloud.google.com/artifacts/docker/myproject/europe-west1/gcf-artifacts "

After the deletion of that manually, every thing work as attended. I don't really understand why...

  • Related