deck.gl: [Bug] Upgrade Deck.gl v9.0.40 to newer version throws error causing React app to not load

Description

Image

Tried upgrading Deck.gl versions in my React app and started getting the above error. React app didn’t load any components, just a blank white screen due to the error with WebGL. Tried looking at documentation and Google but couldn’t find my exact error.

Flavors

  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CARTO
  • ArcGIS

Expected Behavior

No error thrown and React app loads with Deck.gl layers on the map, as it does normally with v9.0.40

Steps to Reproduce

Can’t share exact code due to copyright. But here’s some code I found on codepen that roughly does the same thing.

import {GoogleMapsOverlay as DeckOverlay} from '@deck.gl/google-maps';

 // Create map
 const map = new google.maps.Map(document.getElementById('map'), {
    center: { lat: 40, lng: -100 },
    zoom: 5,
    mapId: GOOGLE_MAP_ID // Only required for Vector maps
 });

 // Create overlay instance
 const overlay = new DeckOverlay({});

 overlay.setProps({
    layers: [added some geojsonlayers],
 });

  // Add overlay to map
  overlay.setMap(map);

Environment

  • Framework version: deck.gl@9.1.8 (but started happening with version 9.1, i think)
  • Browser: Firefox and Chrome
  • OS: macOS 15.3.2

Logs

Image

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 2
  • Comments: 16

Most upvoted comments

As a quick fix without having to modify the package, I just added this to the page where we’re using deck.gl:

import { webgl2Adapter } from '@luma.gl/webgl';
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
webgl2Adapter;

This makes sure the webgl adapter is always included in the js bundle, and that fixed the problem for me.