Skip to content

[Bug]: RasterLayers suddenly throw CGImageSourceCreateImageAtIndex #3898

@catarinadasilva

Description

@catarinadasilva

Mapbox Implementation

Mapbox

Mapbox Version

11.4.1

React Native Version

0.75.3

Platform

iOS, Android

@rnmapbox/maps version

10.1.33

Standalone component to reproduce

import React, {useMemo} from 'react';
import {
  RasterLayer,
  RasterSource,
} from '@rnmapbox/maps';

const tileUrl = 'https://<geoserver>/wms?service=WMS&version=1.1.0&bbox={bbox-epsg-3857}&format=image/png&transparent=true&request=GetMap&srs=EPSG:3857&width=256&height=256&layers=LayerName&tiled=true&authkey=<auth_code>';

const layerId = 'raster.layer';
const sourceId = 'source.1';
const bellowId = 'base.layer';
const visible = true;

const Raster = () => {
    if (! layerId || !sourceId) {
      return null;
    }

    const rasterStyles = useMemo(
      () => ({
        visibility: visible ? 'visible' : 'none',
        rasterOpacity: 0.7,
      }),
      [visible],
    );

    return (
      <RasterSource
        key={layerId}
        id={sourceId}
        tileUrlTemplates={[tileUrl]}
        tileSize={256}
        existing={false}>
        <RasterLayer
          belowLayerID={bellowId}
          existing={true}
          sourceID={sourceId}
          id={layerId}
          style={rasterStyles}
        />
      </RasterSource>
    );
}

export default Raster;

Observed behavior and steps to reproduce

I've observed that this issue started with layers where the tileURI was converted/filled with the substitution of the {bbox-epsg-3857} placeholder by the coordinates, where the coordinates were getting a strange concat value of %252C, after an attempt to upgrade the lib to the latest version and cleaning the node_modules cache it started having issues with the Turbo mode and I rollback to 10.1.33, now the CGImageSourceCreateImageAtIndex happens to all layers and this crashes the app, with no chance to catch the error because there is no onError callback in the Source components.

Expected behavior

It is expected not to throw an error and place an empty layer in its place so that the other layers don't get hidden.
It is also expecting to not nave coordinates with %252C in place of the %2C

Notes / preliminary analysis

The issue started with layers that had %252C in the coordinates

Additional links and references

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.bug 🪲Something isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions