Back

Execution has no response

  • 0
  • Flutter
  • Functions
  • Cloud
dammy
28 Oct, 2023, 13:59

Error on Flutter App Terminal

TypeScript
Receiver: Instance of 'Execution'
Tried calling: response```

**Flutter Code**
```Future phoneValidatorExecutor = functions.createExecution(
      functionId: 'priceListID',
      body: jsonEncode("FetchList"),
      xasync: true,
      path: '/',
      method: 'POST',
      headers: {
        'content-type': 'application/json',
      },
    );
    phoneValidatorExecutor.then((response) {
      dynamic decoded = json.decode(response.response);
      if (kDebugMode) {
        print(decoded.toString());
      }
     List air = decoded["Response"]["air"].values.toList();
 
    }).catchError((error) {
      if (kDebugMode) {
        print("Error gotten from server: ${error.toString()}");
      }
    });```

**Dart Cloud Function Code**
```String requestType = "";
Future<dynamic> main(final context) async {
  context.log('Hello, Logs!');
  context.error('Hello, Errors!');
  requestType = context.log(context.req.bodyRaw);
  if (requestType == "validatorAndPriceList"){
  return context.res.json({
    "Status": normalUsersPriceDetailsSuperSet,
  });
  }
}```
TL;DR
The user is experiencing an issue where their code is throwing a NoSuchMethodError. They are making a function call using `functions.createExecution` but are not receiving a response. The error message suggests that the `Execution` class does not have a `response` property. The user shares their Flutter code and the Cloud Function code they are using. Solution: In the latest version of the SDK, the `Execution` class does not have a `response` property. The user should use the auto-complete feature in their IDE to see what properties are available or refer to the documentation to determine the correct property to use.
Drake
28 Oct, 2023, 15:37

In the latest version of the SDK, there is no response property. Either use the auto complete in the IDE to see what properties are available or read the docs

Drake
28 Oct, 2023, 15:37

Execution has no response

dammy
28 Oct, 2023, 16:08

I used auto complete but couldn't find anything

But is another parts of the codes correct? @Steven

Drake
28 Oct, 2023, 16:14

What do you see when you try to auto complete?

Drake
28 Oct, 2023, 16:15

Xasync should probably be false if you want the function response right away

dammy
28 Oct, 2023, 16:19

hascode runtimeType toString() noSuchMethod

dammy
28 Oct, 2023, 16:20

seems the doc has error< some paramters are not defined

Drake
28 Oct, 2023, 16:33

Oh it's because you put Future phoneValidatorExecutor...

Drake
28 Oct, 2023, 16:33

Change Future to final

Drake
28 Oct, 2023, 16:35

Future is short for Future<dynamic>. When you use dynamic, you lose typing info

dammy
28 Oct, 2023, 17:09

okay but the function is still not able to use request, I mean how do I receive the request sent to the dart function?

Drake
28 Oct, 2023, 17:21

What's your code and what's the auto complete show now?

Drake
28 Oct, 2023, 17:23

That sounds like a different question/problem

Drake
28 Oct, 2023, 17:30

Also, there are problems with your function code. You're not parsing bodyRaw correctly

dammy
28 Oct, 2023, 18:36

did not show related parameter the code is same I just added Future<dynamic>

dammy
28 Oct, 2023, 18:36

how do I pass it well?

Drake
28 Oct, 2023, 22:08

No...I said DONT do that

dammy
29 Oct, 2023, 07:03

i used final, same issue, I even printed runtimeType, it was Future<Execution>

Drake
29 Oct, 2023, 15:01

Can you share a screenshot?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more