Skip to content

Mapbox Studio rejects Historic stylesheet #963

Open

Description

@1ec5

A user on OSMUS Slack reported that they’re unable to load the Historic style into Mapbox Studio to use in their Mapbox-based project.

Steps to reproduce

  1. Go to Mapbox Studio.
  2. Open the dropdown menu next to the “New style” button and choose Upload.
  3. Download the latest Historic stylesheet.
  4. Drag and drop the stylesheet into the Upload dialog and click Customize.

Results

The style should open in Studio, but instead the following alert appears. Clicking Okay dismisses the alert and returns you to the console.

Internal Error: layers[1]: missing required property "source"

Diagnosis

When I tried to reproduce this issue in Firefox 135.0b3 on macOS, I saw some network errors that might implicate our CORS configuration.

Fetch requests to https://www.openhistoricalmap.org/map-styles/main/[email protected] and https://www.openhistoricalmap.org/map-styles/main/[email protected] fail. Fetch requests to https://static-tiles-lclu.s3.us-west-1.amazonaws.com/1/1/0.png and other raster tiles also fail.

Error: NetworkError when attempting to fetch resource. https://www.openhistoricalmap.org/map-styles/main/[email protected]

Fetch requests for vector tiles are blocked for security reasons:

Content-Security-Policy: The page’s settings blocked the loading of a resource (connect-src) at https://vtiles.openhistoricalmap.org/maps/osm/0/0/0.pbf because it violates the following directive: “connect-src 'self' data: blob: https://*.mapbox.com https://*.tiles.mapbox.com [other Mapbox domains] ws://127.0.0.1:* ws://localhost:*/rsbuild-hmr http://localhost:\*”

I’m unsure which of these errors is under our control and which would require action on Mapbox’s part.

Impact

For various reasons, many projects use a Mapbox stack instead of a MapLibre stack. Although our design team migrated from Mapbox Studio to Maputnik a long time ago and the website migrated from Mapbox GL JS to MapLibre GL JS for #650, we should make a best effort to support Mapbox-based projects as long as there aren’t any major obstacles.

Activity

  1. vknoppkewetzel commented on Feb 3, 2025

    @vknoppkewetzel

    My understanding was these styles are not compatible with Mapbox Studio as it is today, because the different between current GL JS and the older GL JS just makes it uncompatible, plus also current Mapbox Studio (even today's probably is different then when I left) has different build under the hood that would not make various layers 1:1 compatible - probably a lot to do with Components.

    Look, even the testing style I did in Mapbox Studio Jan 2023 (just TESTING visual, not in our current code) is no longer compatible with their updates, it looks like

    Image

  2. 1ec5 commented on Feb 3, 2025

    @1ec5
    MemberAuthor

    The stylesheet is compatible with the latest version of Mapbox GL JS, at least from playing around with it in this playground. Mapbox Studio seems to be erroring out as it introspects the stylesheet’s dependencies.

    It isn’t the end of the world if we end up breaking Mapbox compatibility as we add support for something MapLibre-specific, but ideally we could maintain compatibility as long as it doesn’t require any overhead on our part. If the errors are caused by CORS configuration issues on our end, then they would probably affect other tools too. But it kind of looks like one of the errors is just a poor assumption in Studio that a style only uses Mapbox-hosted sources. If Mapbox would like to produce a Mapbox Historical Streets source, it would be a win-win situation for everyone! 😏

  3. jacrys commented on Feb 4, 2025

    @jacrys

    Note: I raised a ticket with Mapbox about the incompatibility, and they agreed it was likely a CORS/CSP issue, and chastised me for using a style "created a long time ago", and that they cannot support custom styles.

  4. 1ec5 commented on Feb 4, 2025

    @1ec5
    MemberAuthor

    The stylesheet is continuously authored, though we just got around to upgrading it to expressions a few months ago. I assume what they actually mean by “a long time ago” is that it’s compatible with the MapLibre Style Specification, which forked from the Mapbox Style Specification a few years ago.

    You’re more than welcome to keep using Mapbox products, but in case it helps, we generally author our stylesheets in Maputnik (kind of similar to Studio) and display them in MapLibre GL JS (a fork of Mapbox GL JS). For a while, we were authoring the stylesheet in Maputnik and displaying them in Mapbox GL JS, which might give you the best of both worlds. As you can see from these instructions, the basics of configuring and displaying a map are practically identical between both libraries.

    I’ll leave this issue open to track any CORS issues on our end.

  5. jacrys commented on Feb 4, 2025

    @jacrys

    I've recommended using Maputnik and Maplibre, our director was hoping to use Mapbox because he was hoping for the partnership (our project has the potential to turn a few heads). Thank you again for bringing this up.

  6. added theissue type on Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions