{"record":{"id":"bb7d21ad790e1184","repo":"grafana/k6","slug":"blob-arraybuffer-is-not-a-function","errorCode":null,"errorMessage":"Blob.[arrayBuffer] is not a function","messagePattern":"Blob\\.\\[arrayBuffer\\] is not a function","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/websockets/helpers.go","lineNumber":46,"sourceCode":"\treturn o.Prototype().Get(\"constructor\") == rt.GlobalObject().Get(\"Uint8Array\")\n}\n\nfunc isDataView(o *sobek.Object, rt *sobek.Runtime) bool {\n\treturn o.Prototype().Get(\"constructor\") == rt.GlobalObject().Get(\"DataView\")\n}\n\nfunc isBlob(o *sobek.Object, blobConstructor sobek.Value) bool {\n\treturn o.Prototype().Get(\"constructor\") == blobConstructor\n}\n\nfunc isObject(val sobek.Value) bool {\n\treturn val != nil && val.ExportType() != nil && val.ExportType().Kind() == reflect.Map\n}\n\nfunc extractBytes(o *sobek.Object, rt *sobek.Runtime) []byte {\n\tarrayBuffer, ok := sobek.AssertFunction(o.Get(\"arrayBuffer\"))\n\tif !ok {\n\t\tcommon.Throw(rt, errors.New(\"Blob.[arrayBuffer] is not a function\"))\n\t}\n\n\tbuffer, err := arrayBuffer(sobek.Undefined())\n\tif err != nil {\n\t\tcommon.Throw(rt, fmt.Errorf(\"call to Blob.[arrayBuffer] failed: %w\", err))\n\t}\n\n\tp, ok := buffer.Export().(*sobek.Promise)\n\tif !ok {\n\t\tcommon.Throw(rt, errors.New(\"Blob.[arrayBuffer] return is not a Promise\"))\n\t}\n\n\tab, ok := p.Result().Export().(sobek.ArrayBuffer)\n\tif !ok {\n\t\tcommon.Throw(rt, errors.New(\"Blob.[arrayBuffer] promise's return is not an ArrayBuffer\"))\n\t}\n\n\treturn ab.Bytes()","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/websockets/helpers.go#L28-L64","documentation":"Error \"Blob.[arrayBuffer] is not a function\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/websockets/helpers.go:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}