-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suppress error messages for missing tiles #1800
Comments
Or maybe add the ability to import stuff in the original tile set street-v6 in studio so you don't have to make a incomplete data set with no tiles in the first place? Ps also note that you can not disable does 404's in chrome console, so worker debug messages end up in between does 404. |
If we supress all 404 errors, how do we handle situations with e.g. a typo in the url leading to all tiles being 404? That would go unnoticeable. |
404s will still be visible in the network page of developer tools (and for unexpected errors like bad URLs, visible as missing tiles in the map). This ticket is about suppressing the extra logging to the JS console that is happening right now. I don't think that there's a way to programmatically distinguish "expected" and "unexpected" 404s, so I think we'll accept that "unexpected" 404s only get logged to the normal places. |
Also, the long-term fix here is to encourage using HTTP 204 "No Content" response in tile APIs to indicate lack of a tile at the requested coordinates, and reserving 404 for real unexpected errors. I've ticketed this internally for future versions of the Mapbox tile API. |
We will address this issue through using HTTP 204 "No Content" codes and implementing #1775 |
It's going to be awhile before we can rely on 204, and this comes up often with @mapbox/support. Let's add the suppression. |
What would be the correct way to suppress the error? Not calling the callback with the |
Maybe this isn't the right place to be posting this, but I haven't found anywhere explaining why I'm even getting these 404s in the first place. I created a map using mapbox studio and am simply using the style address provided. I'm authenticating with the API key given, and the map is rendering perfectly fine. Somehow I'm still getting hundreds of 404 messages from missing tiles clogging up my console, which makes it difficult to notice relevant errors. Does anyone have a clear explanation of what causes these in the first place and how to fix it at the source, within Mapbox Studio? I had created the tileset using tippecanoe, if that makes a difference. |
If the data is limited to a small geographic region, tiles outside this region will currently return 404 I believe. Is that what you're seeing? |
Yeah, looks like it. This particular map isn't actually related to any geographic location so I'm just using a blank background instead of the globe. I think the dataset is about the size of Germany. And yeah if I zoom into the middle of it I stop getting 404s. Is there a workaround or a better way to display small datasets? |
@redbmk only way we found, is explained in my my comment above |
I am on version 0.38.0 and errors are still being thrown. Also the following code logs 'Error' (not 'Error: Not Found') for me:
|
I am also getting this error. |
that's because the code is minified: it does say 404!==i.status somewhere |
@mvanroon Apologise, you are correct. I'll keep digging! |
This issue refers to suppressing error messages produced by Mapbox GL JS itself, with the text "Error: Not Found". It's expected that error messages like "Failed to load resource: the server responded with a status of 404" still appear: those messages are logged by the browser itself, and there's no way for Mapbox GL JS to suppress them. To suppress those message, the tile server needs to return HTTP 204 "No Content" rather than 404. (We have an internal issue tracking making that change for the Mapbox Tile API.) |
For anyone who doesn't want to wait for a tile server fix and doesn't mind suppressing all 404 errors:
|
@skaletech Are you not able to do something like that with |
map.on('error'...) does not seem to fire when an Actor.receive error occurs. I think that is because the mapbox code is just calling console.error() This is just a hack to clear your console from a bunch of garbage errors. |
I just tested this code with
|
Sorry, I'm on the bleeding edge, 44.0. I did not get any such error, it is definitely going through console.error() |
Hmm, the other difference is I'm using a custom tile server and just telling it to return 404s. Not sure what else would be different about your setup. I wouldn't mind playing around with it if you set up a simple demo in e.g. jsfiddle. It looks like the code should let you intercept those errors, so I'm not sure why it doesn't seem to be working. |
We're using something other than mapbox that gives a 404 when the tile is empty. I'm not really interested in fixing the issue, since I have something that works fine for my use case. The only reason I would want to see 404 in my JS console is if the entire layer was returning 404 because of a configuration issue, but that's not an issue since it would be visible. I just wanted to post my work around in case someone else is getting superfluous errors. If the map.on('error') thing worked for me, I would have used it. |
Gotcha, no worries then. FWIW, I find returning a 204 (No Content) doesn't end up throwing any errors in the console. |
Hi, Any update on how to suppress this issue? I still get the 404 error for the "Tile not found" error. I don't want these error messages to pop up on the console. Any help appreciated. |
There is log spew about missing tiles, though it is valid for a tile endpoint to return a 404 to express "no data". We should suppress these error messages.
ref #1549
The text was updated successfully, but these errors were encountered: