Skip to content

Map: stop the CARTO "API KEY REQUIRED" watermark (key support + keyless OSM fallback) - #22

Merged
jameshiggins merged 1 commit into
mainfrom
fix/carto-basemap-api-key
Sep 24, 2026
Merged

jameshiggins merged 1 commit into
mainfrom
fix/carto-basemap-api-key

Conversation

@jameshiggins

Copy link
Copy Markdown
Owner

Summary

Fixes the "API KEY REQUIRED" watermark covering the basemap on roastmap.ca/map.

Root cause: CARTO began enforcing API keys on basemaps.cartocdn.com in late August 2026. Anonymous tile requests still render but are watermarked. The roaster pins were never affected — /api/roasters is fine — only the basemap tiles.

Change

New src/components/mapTiles.js selects the tile layer (pure module, unit-tested, no Leaflet import):

VITE_CARTO_API_KEY Provider Dark mode
set CARTO light_all / dark_all (unchanged styles) with ?key= appended native dark style
unset OpenStreetMap standard tiles (keyless) layer tagged .map-tiles--inverted → CSS invert + hue-rotate

LeafletMap keys the TileLayer on provider + theme so a swap remounts the layer (react-leaflet ignores a mutated url prop). Attribution drops the CARTO credit on the OSM path. index.html gains a dns-prefetch for the OSM host; .env.example and the README document the variable.

After merge — action needed

  1. Request a free CARTO basemaps key at https://carto.com/basemaps/apikey/ (email form, no account, 5M tiles/month).
  2. Set VITE_CARTO_API_KEY in the Vercel project env and redeploy.

Until the key is in place the map serves keyless OSM tiles, so the watermark is gone immediately on merge — the key just restores the theme-matched CARTO styling.

Verification

npm run lint (0 errors), npm run typecheck, npm test (332 passing, +6 new), npm run build all clean. Leaflet chunk size unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WQPoqZvpFtcjR76PFyVv99


Generated by Claude Code

…ess OSM fallback

CARTO began enforcing API keys on basemaps.cartocdn.com in late August
2026; anonymous tile requests still render but carry a repeated
"API KEY REQUIRED" watermark, which is what roastmap.ca/map has been
showing. The roaster pins were never affected — only the basemap.

New src/components/mapTiles.js picks the tile layer:
- VITE_CARTO_API_KEY set → the existing theme-matched CARTO light/dark
  styles with ?key= appended (free key, 5M tiles/month, requested by
  email at carto.com/basemaps/apikey — no account needed).
- unset → OpenStreetMap's keyless standard tiles. They only come in a
  light style, so dark mode tags the layer with .map-tiles--inverted and
  a CSS invert + hue-rotate keeps the dark canvas. Attribution drops the
  CARTO credit on this path.

LeafletMap keys the TileLayer on provider + theme so a swap remounts the
layer (react-leaflet ignores a mutated url prop). Pure module, unit
tested; the Leaflet chunk is unchanged in size.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WQPoqZvpFtcjR76PFyVv99
@vercel

vercel Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
coffee-tracker-react Ready Ready Preview Sep 22, 2026 6:25am UTC
coffee-tracker-react-rrhm Ready Ready Preview Sep 22, 2026 6:25am UTC

@jameshiggins
jameshiggins marked this pull request as ready for review September 24, 2026 20:05
@jameshiggins
jameshiggins merged commit d4388d7 into main Sep 24, 2026
4 checks passed

This branch was successfully deployed

2 active deployments
Preview – coffee-tracker-react-rrhm — 1102fdb1 Deployed Sep 22, 2026 by vercel[bot]
Preview – coffee-tracker-react — 1102fdb1 Deployed Sep 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants