No requests being made

Hello,

I am on the free plan and have been using it for development, with the plan to move over to the scale plan when I launch my app. I was working on it with no problems on Sunday 1st October, but when I ran the app on Monday 2nd the app kept crashing because backendless only returns null values. When I checked the analytics console it shows that no requests have been made? But somehow concurrent requests have been made?

Please help!

All the best,

Ilayda

Developers already investigating why concurrent request is higher than the count of request. But can you clarify what the main issue that is worrying you?

Regards, Dima.

The main issue is that none of my GET requests are returning data! Without me making any changes to the backendless requests that were already working perfectly, overnight my app has stopped working because null values cannot be displayed.

What kind of requests returns null for you? Could you share how your logic look?

Sure,

This is the code that has been working for me for over 3 weeks but mysteriously stopped working overnight:

Future<List<Venue?>?> getAllVenues() async {
    var query = DataQueryBuilder()
      ..sortBy = ['created DESC']
      ..related = ['linkedExhibits', 'linkedCategories'];
    var dbdata = Backendless.data.withClass<Venue>().find(query);
    return dbdata;
  }

I have several other queries like this to fetch all the data I need for the app (which run when the app initialises) and all of them are broken. Also do you know why it is showing 0 requests in the analytics console?

Ilayda

Could you wrap your code in try / catch and check if there are no any errors?

For now, concurrent requests from the console(develop.backendless.com) are also counted in this statistic.

I’ve been trying to wrap the relevant functions in try catch statements, but they are not logging anything. Here is what I’ve done for fetching Venue data:

In main.dart the MaterialApp widget is wrapped in a MultiProvider and one of the providers is:

MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (context) => VenueProvider()),
],
      child: Sizer(builder: (context, orientation, deviceType) {
        return MaterialApp( 
        //rest of code

The following is the code for the VenueProvider:

class VenueProvider extends ChangeNotifier {
  final VenueService _service = VenueService();
  bool isLoading = false;
  List<Venue?>? _allVenues;
  List<Venue?>? get allVenues => _allVenues;

  getAllVenues() async {
    isLoading = true;
    notifyListeners();

    try {
      final response = await _service.getAllVenues();  // getAllVenues fn is the one I posted above

      _allVenues = response;
    } catch (error) {
      logger.d('Error fetching venues: $error');
    } finally {
      isLoading = false;
      notifyListeners();
    }
  }
}

When I start the app from cold nothing logs out. This is concerning as I cannot continue working on it (as it doesn’t open) and also I am worried if this were to happen in production! I tried wrapping the MultiProvider in a try catch block as well but nothing logged there either.

I look forward to hearing from you soon!

Ilayda!

Hi @Ilayda_B ,

The situation which you observed on “Performance” tab is caused by fact that server counts both, API and Console requests, in “concurrent requests” while for “requests” only API calls are counted.

We will going to fix this so only API calls will be counted in “concurrent requests” to avoid confusion.

Regards, Andriy

Hello again, @Ilayda_B.

I’ve been research your code and found one mistake. You are using an asynchronous code but not awaiting for result that’s why you got null value from this request.
This row of code is wrong:
var dbdata = Backendless.data.withClass<Venue>().find(query);
Just add await before request this method and your problem has been resolved.

Regards, Nikita.

Hi Dima, Nikita and Andriy,

Thanks for taking a look at my problem, and getting back to me - I really appreciate it. I added the await keyword like you suggested (to all my functions that were making get requests) but the issue still stands that only null is returned (and therefore the app doesn’t load and only has a blank screen!) :sob:

var dbdata = await Backendless.data.withClass<Venue>().find(query);

I have no idea what to do, and am still puzzled by the fact that it stopped working overnight. Is there any link to this and using the free plan? I also fear that somehow the Providers could be to blame because none of the logging statements I put into them are showing up. What’s confusing me though is that I only made styling changes and then suddenly the next day the app doesn’t run. I’m not sure if you can suggest anything that might help, but I’d be very grateful for any knowledge you can share!

All the best,

Ilayda

Hello, @Ilayda_B.

Could you try to call some rest operations in your application WITHOUT USING flutter. For example, using the Backendless console or you can download a separate application to do this (for example Postman).

Regards, Nikita.

Good afternoon Nikita,

I successfully made a GET request for Venue data using the REST console and it worked! I hadn’t thought to do that so thanks for the suggestion. So I assume this means the problem is with Flutter somehow and not with Backendless (whew!). I will continue to research what’s gone wrong and post the solution in this thread in hopes it can help anyone else in my situation.

Thanks for the collective help team! It is very much appreciated.

Kind regards,

Ilayda

1 Like