deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

Unknown shader module project32

Open cschlueter opened this issue 7 years ago • 27 comments

Description

My usage of path layer leads to error: "Unknown shader module project32" Same goes for this example: https://deck.gl/showcases/gallery/highway

Repro Steps

Use example above.

Environment (please complete the following information):

  • Framework Version:
  • Browser Version: Version 76.0.3809.6 (Official Build) canary (64-bit)
  • OS: Mac OS X 10.14.5

Logs

dist.min.js:1 deck: error while initializing PathLayer({id: 'path-layer'}) Error: Unknown shader module project32 at i (dist.min.js:1) at e.value (dist.min.js:1) at dist.min.js:1 at Array.map () at e.value (dist.min.js:1) at h (dist.min.js:1) at T (dist.min.js:1) at t.value (dist.min.js:1) at t.value (dist.min.js:1) at t.value (dist.min.js:1) value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 setProps @ dist.min.js:12 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 (anonymous) @ dist.min.js:1 Promise.then (async) value @ dist.min.js:1 e @ dist.min.js:1 o @ dist.min.js:12 (anonymous) @ 2416456071?v=5:147 dist.min.js:1 Uncaught (in promise) Error: Unknown shader module project32 at i (dist.min.js:1) at e.value (dist.min.js:1) at dist.min.js:1 at Array.map () at e.value (dist.min.js:1) at h (dist.min.js:1) at T (dist.min.js:1) at t.value (dist.min.js:1) at t.value (dist.min.js:1) at t.value (dist.min.js:1) i @ dist.min.js:1 value @ dist.min.js:1 (anonymous) @ dist.min.js:1 value @ dist.min.js:1 h @ dist.min.js:1 T @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 e @ dist.min.js:1 t @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 setProps @ dist.min.js:12 value @ dist.min.js:1 value @ dist.min.js:1 value @ dist.min.js:1 (anonymous) @ dist.min.js:1 Promise.then (async) value @ dist.min.js:1 e @ dist.min.js:1 o @ dist.min.js:12 (anonymous) @ 2416456071?v=5:147

cschlueter avatar Jun 07 '19 08:06 cschlueter

Actually this bug appears on a few examples. It also does not depend on Browser, both Safari and Chrome are affected.

cschlueter avatar Jun 07 '19 09:06 cschlueter

Happens with GeoJson Layer as well.

Error message:

dist.min.js:1 deck: error while initializing PathLayer({id: 'GeoJsonLayer-line-strings'})
 Error: Unknown shader module project32
const geojsonLayer = new deck.GeoJsonLayer({
    data: fc,
    pickable: false,
    stroked: false,
    filled: false,
    extruded: false,
    lineWidthScale: 20,
    lineWidthMinPixels: 2,
    getFillColor: [160, 160, 180, 255],
    getLineColor: [160, 160, 180, 255],
    getLineWidth: 10,
    opacity: 0.8,
    wireframe: true,
    fp64: true,
    getElevation: 100,
});

Where "fc" is a FeatureCollection only consisting of one LineString with hundreds of coordinates.

var fc = {
    "type": "FeatureCollection",
    "features": [
        feature
    ]
}

cschlueter avatar Jun 07 '19 09:06 cschlueter

@cschlueter Thanks for reporting. Please use https://unpkg.com/[email protected]/dist.min.js as we address this issue.

@ibgreen Tree shaking is broken by https://github.com/uber/deck.gl/pull/3202.

Pessimistress avatar Jun 07 '19 15:06 Pessimistress

Fixed in 7.1.2. It is available on either

https://unpkg.com/[email protected]/dist.min.js

or

https://unpkg.com/deck.gl@latest/dist.min.js.

The ^7.0.0 cache on unpkg.com may need some time to refresh.

Pessimistress avatar Jun 07 '19 18:06 Pessimistress

Thanks, selecting the version 7.1.2 explicitly did the trick.

cschlueter avatar Jun 07 '19 19:06 cschlueter

I still getting this error on 7.1.4 with ScatterplotLayer without using pre-bundled versions.

sebastibe avatar Jun 14 '19 10:06 sebastibe

I'm still blocked by this issue when trying to build an application with the following config:

{
  "engineStrict": true,
  "scripts": {
    "watch": "webpack -d --watch",
    "build": "webpack -p --progress",
    "rollup-build": "npx rollup -c"
  },
  "dependencies": {
    "nebula.gl": "^0.14.0",
    "nebula.gl-react": "^0.10.5",
    "react": "16.5.0",
    "react-dom": "16.5.0",
    "react-map-gl": "^5.0.3"
  },
  "resolutions": {
    "@deck.gl/core": "7.2.0-alpha.1"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/plugin-proposal-decorators": "^7.0.0",
    "@babel/plugin-proposal-export-default-from": "^7.2.0",
    "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
    "@babel/plugin-proposal-function-sent": "^7.0.0",
    "@babel/plugin-proposal-json-strings": "^7.0.0",
    "@babel/plugin-proposal-numeric-separator": "^7.0.0",
    "@babel/plugin-proposal-throw-expressions": "^7.0.0",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
    "@babel/plugin-syntax-import-meta": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/preset-flow": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "babel-loader": "^8.0.0",
    "babel-preset-minify": "^0.5.0",
    "bourbon": "^4.3.4",
    "css-loader": "^0.28.11",
    "extract-text-webpack-plugin": "^4.0.0-beta.0",
    "file-loader": "^0.11.2",
    "rollup": "^1.15.3",
    "rollup-plugin-babel": "^4.3.0",
    "rollup-plugin-commonjs": "^9.2.0",
    "rollup-plugin-json": "^3.1.0",
    "rollup-plugin-node-builtins": "^2.1.2",
    "rollup-plugin-node-globals": "^1.4.0",
    "rollup-plugin-node-resolve": "^4.0.0",
    "rollup-plugin-replace": "^2.1.0",
    "url-loader": "^0.5.9",
    "webpack": "^4.34.0",
    "webpack-cli": "^3.3.4"
  }
}

I have tried different versions of @deck.gl/core after 7.1 but I can't seem to find the initializeShaderModules in the generated bundle. Am I missing something?

sebastibe avatar Jun 22 '19 15:06 sebastibe

@sebastibe Can you try the following:

  • Check if the global object deck exists in the console, and deck.version matches your installed version (7.2.0-alpha.1).
  • With source map on, see if https://github.com/uber/deck.gl/blob/master/modules/core/src/lib/init.js#L46 is executed.

Pessimistress avatar Jun 24 '19 21:06 Pessimistress

  • One weird thing I noticed is that I always seem to have the deck version one minor version below the one required: (7.1.6 if I require 7.2.0-alpha.1, 7.1.5 if I require 7.1.6 etc...)
  • I don't find the initializeShaderModules function in the source maps which could indicate I might have an issue with my webpack config. Here it is below for reference:
const resolve = require('path').resolve;
const join = require('path').join;
const dirname = require('path').dirname;
const webpack = require('webpack');

const BUILD_DIR = resolve(__dirname, 'target', 'cljsbuild', 'public');
const APP_DIR = resolve(__dirname, 'src', 'js');
const SCSS_DIR = resolve(__dirname, 'src', 'sass');
const MAP_GL_CSS_DIR = resolve(__dirname, 'node_modules', 'mapbox-gl');

const ExtractTextPlugin = require("extract-text-webpack-plugin");

const extractSass = new ExtractTextPlugin({
  // filename: "[name].[contenthash].css"
  filename: "css/[name].css"
  // disable: process.env.NODE_ENV === "development"
});

const config = {
  entry: [
    `${APP_DIR}/main.js`,
    `${MAP_GL_CSS_DIR}/dist/mapbox-gl.css`,
  ],
  output: {
    path: BUILD_DIR,
    filename: 'js/bundle.js'
  },
  resolve: {
    extensions: ['.js', '.scss']
  },
  module: {
    rules: [
      // Compile ES2015 using babel
      {
        test: /\.js$/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: [
              require('@babel/preset-env'),
              require('@babel/preset-react'),
              require('@babel/preset-flow')
            ],
            plugins: [
              require('@babel/plugin-proposal-class-properties'),
              require('@babel/plugin-proposal-export-default-from')
            ]
          },
        },
        exclude: /node_modules/,
        include: [resolve('.')]
      },
      {
        // webpackl 4 fix for broken turf module: https://github.com/uber/nebula.gl/issues/64
        test: /\.mjs$/,
        include: /node_modules/,
        type: 'javascript/auto'
      },
      {
        test: /\.css$/,
        use: extractSass.extract({
          use: [{
            loader: "css-loader", // translates CSS into CommonJS
            options: {
              includePaths: [
                // From mapbox-gl-js README.
                // Required for non-browserify bundlers (e.g. webpack):
                join(dirname(module.filename), 'node_modules/mapbox-gl/dist'),
                // join(dirname(module.filename), 'node_modules/weather-icons/css')
              ]
            }
           }],
           fallback: "style-loader" // creates style nodes from JS strings
        })
      },
      {
        test: /\.scss$/,
        use: extractSass.extract({
          use: [{
            loader: "css-loader" // translates CSS into CommonJS
          }, {
            loader: "sass-loader", // compiles Sass to CSS
            options: {
              includePaths: [
                join(dirname(module.filename), 'node_modules')
              ]
            }
          }],
          fallback: "style-loader" // creates style nodes from JS strings
        })
      },
      {
        test: /\.(woff|woff2)$/,
        use: {
          loader: 'url-loader',
          options: {
            name: 'fonts/[hash].[ext]',
            limit: 5000,
            mimetype: 'application/font-woff'
          }
        }
      }, {
        test: /\.(ttf|eot|svg)$/,
        use: {
          loader: 'file-loader',
          options: {
            name: 'fonts/[hash].[ext]'
          }
        }
      }
    ]
  },
  plugins: [
    extractSass,
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('production')
    })
  ]
};

module.exports = config;

sebastibe avatar Jun 24 '19 22:06 sebastibe

@sebastibe Your package.json does not explicitly depend on any deck.gl packages. They are not dependencies of the latest nebula.gl either.

nebula-react looks like a deprecated package since it's depending on an old version of nebula.gl which depends on an older version of deck.gl.

The ultimate test is always running yarn list @deck.gl/core to see exactly how many copies and what versions are installed.

@cschlueter This doesn't seem to be related to your issue, feel free to close and we can move to a different thread.

Pessimistress avatar Jun 24 '19 23:06 Pessimistress

@Pessimistress I'm still blocked on this issue.

  • I have confirmed that I could have a clean install and only one version of deck.gl with the following packages:
    "@deck.gl/core": "^7.1.7",
    "@deck.gl/layers": "^7.1.7",
    "@deck.gl/react": "^7.1.7",
    "@luma.gl/constants": "^7.1.1",
    "@luma.gl/core": "^7.1.1",
    "@nebula.gl/layers": "^0.14.0",
  • I have confirmed that the initializeShaderModules function was called with the debugger.

I'm a bit out of imagination on where to go from here, any ideas?

sebastibe avatar Jul 10 '19 11:07 sebastibe

@sebastibe Can you run yarn list @luma.gl/core

Pessimistress avatar Jul 10 '19 19:07 Pessimistress

╰─ yarn list @luma.gl/core
yarn list v1.16.0
└─ @luma.gl/[email protected]

sebastibe avatar Jul 11 '19 02:07 sebastibe

Nothing jumps out to me from the information you've shared. This error might be caused by one of the following:

  • Multiple copies of @deck.gl/core or @luma.gl/core in node_modules. This can be verified with yarn list <package>. The fix is to use matching dependency versions in package.json, remove yarn.lock and perform a clean install.
  • Multiple copies of @deck.gl/core or @luma.gl/core as a result of some local setup, such as yarn link, use of module-alias module, resolve.alias in webpack config, inclusion of both locally-bundled and pre-bundled versions, etc.
  • Overly aggressive tree shaking - I've seen this if the sideEffects field in package.json is not respected, usually due to a custom minifier config. This can be verified by checking if the global deck object exists in the runtime console.

Pessimistress avatar Jul 11 '19 18:07 Pessimistress

This error occurred when I used @deck.gl/geo-layers to create TripsLayers. @Pessimistress According to the tips,I deleted the node_modules and yarn.lock files and reinstalled them using yarn install, but this error still appears.I have no used of module-alias and minifier config. This is a screenshot of the browser console error, which keeps growing. image In addition, there is another error: image Packages: "deck.gl": "^7.1.10", "@deck.gl/core": "^7.1.10", "@deck.gl/mapbox": "^7.1.10", "@deck.gl/geo-layers": "^7.1.10", Am I missing something?:frowning:

helennf avatar Jul 24 '19 10:07 helennf

I am seeing this issue as well. I am using npm to install my packages and it is an angular application. I am building the application with ng build --prod which is using webpack under the hood. The deck.gl version I am using is 7.1.10. I have switched to including deck.gl via <script src="https://unpkg.com/deck.gl@latest/dist.min.js"></script> which is not optimal, but functions as a workaround until I can have it properly included in my application when building.

SterlingMcCall avatar Jul 24 '19 15:07 SterlingMcCall

Any update on this? I'm having the same issue

    "@deck.gl/core": "^7.1.10",
    "@deck.gl/mapbox": "^7.1.10",
    "@loaders.gl/images": "^1.1.6",
    "@luma.gl/constants": "^7.1.1",
    "deck.gl": "^7.1.10",
    "luma.gl": "^7.1.1",

A clean install doesn't solve it

mbarrenechea avatar Jul 29 '19 09:07 mbarrenechea

@mbarrenechea have you tried run yarn list @luma.gl/core? Most likely you have multiple copies because Luma is already a dependency of deck.

Pessimistress avatar Jul 29 '19 14:07 Pessimistress

Just an update I changed my dependencies to

    "deck.gl": "7.0.0",
    "luma.gl": "^7.1.1",

and now it works... Who knows....

mbarrenechea avatar Jul 29 '19 15:07 mbarrenechea

@Pessimistress yes I run it and I only had one

yarn list @luma.gl/core
yarn list v1.17.0
└─ @luma.gl/[email protected]

mbarrenechea avatar Jul 29 '19 15:07 mbarrenechea