{"record":{"id":"6c8a49a6324a07fc","repo":"grafana/k6","slug":"couldn-t-get-arraybuffer-isview-as-it-isn-t-a-func","errorCode":null,"errorMessage":"couldn't get ArrayBuffer.isView as it isn't a function","messagePattern":"couldn't get ArrayBuffer\\.isView as it isn't a function","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/websockets/websockets.go","lineNumber":724,"sourceCode":"\t\tmtype: websocket.BinaryMessage,\n\t\tdata:  b,\n\t\tt:     time.Now(),\n\t}\n}\n\nfunc isArrayBufferView(rt *sobek.Runtime, v sobek.Value) (bool, error) {\n\tvar isView sobek.Callable\n\tvar ok bool\n\texc := rt.Try(func() {\n\t\tisView, ok = sobek.AssertFunction(\n\t\t\trt.Get(\"ArrayBuffer\").ToObject(rt).Get(\"isView\"))\n\t})\n\tif exc != nil {\n\t\treturn false, exc\n\t}\n\n\tif !ok {\n\t\treturn false, fmt.Errorf(\"couldn't get ArrayBuffer.isView as it isn't a function\")\n\t}\n\n\tboolValue, err := isView(nil, v)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn boolValue.ToBoolean(), nil\n}\n\n// Ping sends a ping message over the websocket.\nfunc (w *webSocket) ping() {\n\tw.assertStateOpen()\n\n\tpingID := strconv.Itoa(w.sendPings.counter)\n\n\tw.writeQueueCh <- message{\n\t\tmtype: websocket.PingMessage,\n\t\tdata:  []byte(pingID),","sourceCodeStart":706,"sourceCodeEnd":742,"githubUrl":"https://github.com/grafana/k6/blob/165bb3c1a492b7a4823907fe1e93a30645794737/internal/js/modules/k6/websockets/websockets.go#L706-L742","documentation":"Environment guard in the ArrayBufferView detection helper: isArrayBufferView looks up ArrayBuffer.isView in the current Sobek runtime and asserts it is callable. This sentinel error is returned when the property exists but is not a function (or is missing), meaning the script's global environment has been modified — a polyfill, mock, or accidental assignment has clobbered the built-in ArrayBuffer.isView.","triggerScenarios":"Thrown at internal/js/modules/k6/websockets/websockets.go:699 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove any script code that reassigns ArrayBuffer.isView or the ArrayBuffer global","Disable libraries or shims that replace standard built-ins","Send strings or Blobs instead of typed arrays to avoid the isView lookup entirely"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"165bb3c1a492b7a4823907fe1e93a30645794737","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}