Maps: Mapbox [info] Request failed due to a permanent error: Canceled

Created on 30 Jun 2020  路  6Comments  路  Source: react-native-mapbox-gl/maps

I'm constantly facing with this problem.
Every time when its loading or zooming or panning or do anything always logging this problem. Even sometimes giving it in yellow box. This is the message :

Mapbox [info] Request failed due to a permanent error: Canceled {"level": "warning", "message": "Request failed due to a permanent error: Canceled ", "tag": "Mbgl-HttpRequest"}

I dont know that to do. I give permissions to work but still the same.
This is the AndroidManifest.xml

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 

And then i am checking user accepted or not

RequestPermision = async () => {
        const permission = await MapboxGL.requestAndroidLocationPermissions();
        this.setState({ permissionIsGranted: permission });
    } 

if user give the permission i show the map.
Can you help me ?

Most helpful comment

To elaborate a bit on mfazekas reply:
This is normal behaviour of Mapbox as described in this upstream ticket. In short, when zooming or panning around, operations that were about to load tiles from the server will be cancelled as they are no longer valid - this message is just notifying devs about this action.

It can be annoying at times to, that's why the repo exposes the Logger class to users, and you can disable/ ignore all sorts of warning/ errors that you dislike - it was mentioned in this ticket, however I'll give an example here as well for easy copy/ paste usage:

import Mapbox, { Logger } from '@react-native-mapbox-gl/maps';

// edit logging messages
Logger.setLogCallback(log => {
  const { message } = log;

  // expected warnings - see https://github.com/mapbox/mapbox-gl-native/issues/15341#issuecomment-522889062
  if (
    message.match('Request failed due to a permanent error: Canceled') ||
    message.match('Request failed due to a permanent error: Socket Closed')
  ) {
    return true;
  }
  return false;
});

If you're using TS, you'll get a linting warning, mentioning, that Logger is not exported - I'll open a PR for that ~this week~ some time.

Cheers 馃嵒

All 6 comments

This is normal, when zooming. You can supress this with a custom logCallback, if you'd like to.

https://github.com/react-native-mapbox-gl/maps/blob/498b86b01e7956ac3d1319ac4918e2ee49d57333/javascript/utils/Logger.js#L20-L27

this is really annoying bug / future, it happen to me all the time and fill my log with errors, several of them every second,

image

I don't understand why it happen , who to prevent it or how to hide it.

Same issue

To elaborate a bit on mfazekas reply:
This is normal behaviour of Mapbox as described in this upstream ticket. In short, when zooming or panning around, operations that were about to load tiles from the server will be cancelled as they are no longer valid - this message is just notifying devs about this action.

It can be annoying at times to, that's why the repo exposes the Logger class to users, and you can disable/ ignore all sorts of warning/ errors that you dislike - it was mentioned in this ticket, however I'll give an example here as well for easy copy/ paste usage:

import Mapbox, { Logger } from '@react-native-mapbox-gl/maps';

// edit logging messages
Logger.setLogCallback(log => {
  const { message } = log;

  // expected warnings - see https://github.com/mapbox/mapbox-gl-native/issues/15341#issuecomment-522889062
  if (
    message.match('Request failed due to a permanent error: Canceled') ||
    message.match('Request failed due to a permanent error: Socket Closed')
  ) {
    return true;
  }
  return false;
});

If you're using TS, you'll get a linting warning, mentioning, that Logger is not exported - I'll open a PR for that ~this week~ some time.

Cheers 馃嵒

I have to import it that way. (8.1.0)

import Logger from '@react-native-mapbox-gl/maps/javascript/utils/Logger';

I have to import it that way. (8.1.0)

import Logger from '@react-native-mapbox-gl/maps/javascript/utils/Logger';

There shouldn't be a need for that, as it's exported within index.js:
https://github.com/react-native-mapbox-gl/maps/blob/ddb34e026cee688710ad2f8815f5000eccd0437f/javascript/index.js#L148

Was this page helpful?
0 / 5 - 0 ratings