Skip to content

Remove usage of buffer in SubsurfaceViewer to avoid "Buffer is undefined" error in MergeTextLayer #2540

Open
@Anders2303

Description

@Anders2303

In the webviz project, Im unable to get the WellLogLabels layer to render, with the following error being logged to the console. No labels are shown

deck: update of WellLabelLayer({id: '7d6bd300-ebd8-4a68-afbb-59528e6f2726-labels'}): Cannot read properties of undefined (reading 'isBuffer') TypeError: Cannot read properties of undefined (reading 'isBuffer')
    at Object.free (chunk-NKSH75QN.js?v=6ebe15d1:2028:18)
    at createKDTree (chunk-NKSH75QN.js?v=6ebe15d1:3214:12)
    at WellLabelLayer.updateLabelClusters (chunk-NKSH75QN.js?v=6ebe15d1:3383:59)
    at WellLabelLayer.updateState (chunk-NKSH75QN.js?v=6ebe15d1:3312:12)

The issue seems to stem from the following line in the typedarray-pool package, which is introduced from static-kdtree.

var Buffer = require('buffer').Buffer
// ...
Buffer.isBuffer(...) // <-- Buffer is undefined

This seems unrelated to the LabelsLayer config itself, but rather some environment difference between webviz and the storybooks here, but Im unable to pinpoint exactly what the difference is (for refference, I've been running both projects in node 18, and the problem only shows up on our end).

This might be as simple as the typedarray-pool library being outdated (both it and static-kdtree havent been updated for 6+ years), so we might want to look for a replacement for static-kdtree

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmap-componentIssues related to the map component.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions