question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

First argument to DataView constructor must be an ArrayBuffer when using inspect()

See original GitHub issue

I’m trying to implement gltf-transform into my Vue project in order to make use of the inspect() method for my gltf/glb files.

This is what I’m trying to do

import { WebIO } from '@gltf-transform/core'
import { inspect } from '@gltf-transform/lib'

// data.gltf === a URL at which the resource can be achieved (I can link it if necessary)
const gltfFile = data.gltf
const io = new WebIO()
const doc = await io.read(gltfFile)
inspect(doc)

But I seem to be getting this error

caught TypeError: First argument to DataView constructor must be an ArrayBuffer
    at new DataView (<anonymous>)
    at Function.m (core.modern.js:1)
    at Function.getSize (core.modern.js:1)
    at lib.modern.js:1
    at Array.map (<anonymous>)
    at q (lib.modern.js:1)
    at k (lib.modern.js:1)
    at _callee$ (_modelId.vue:180)
    at tryCatch (runtime.js:63)
    at Generator.invoke [as _invoke] (runtime.js:293)
    at Generator.next (runtime.js:118)
    at asyncGeneratorStep (asyncToGenerator.js:3)
    at _next (asyncToGenerator.js:25)

Any ideas as to what I’m doing wrong?

(Apologies if this isn’t the right place to post this, let me know if it would be better suited for somewhere else)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
duncan-vrifycommented, Feb 5, 2021

Ahhh, that’s helpful. I will investigate that further, thank you!

0reactions
donmccurdycommented, Feb 5, 2021

I’m not sure why the tool is reading this file without clearer warnings, but it seems to have two entries for images that are not valid:

"images": [
  {
    "mimeType": "image/png"
  },
  {
    "mimeType": "image/png"
  }
],

^Those should have either a bufferView or a uri property to be valid, without them there is no image data. It may be a bug in COLLADA2GLTF, which seems to be the converter that produced this model.

I’ll make some adjustments to ensure that glTF-Transform provides a more useful warning about this issue. In the meantime https://github.khronos.org/glTF-Validator/ may be helpful for double-checking your model’s validity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

First argument to DataView constructor must be an ArrayBuffer
Yes. The database will open properly and work just fine but through some event, either me closing the browser window or something else....
Read more >
DataView() constructor - JavaScript - MDN Web Docs
DataView() constructor. The DataView() constructor is used to create DataView objects. ... If unspecified, the buffer view starts with the first byte.
Read more >
Using EXIF and BinaryFile get an error - Stack Overflow
But I get: TypeError: First argument to DataView constructor must be an ArrayBuffer ? How can I get this array buffer? I'm using...
Read more >
First argument to DataView constructor must be an ArrayBuffer
When attempting to open database in Chrome I receive the following error: "First argument to DataView constructor must be an ArrayBuffer".
Read more >
Memory Inspector: Inspect ArrayBuffer, TypedArray, DataView ...
Use the new Memory inspector to inspect ArrayBuffer , TypedArray , and DataView memory in JavaScript as well as WebAssembly.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found