grafana/k6 · error

Blob.[arrayBuffer] is not a function

Error message

Blob.[arrayBuffer] is not a function

What it means

Error "Blob.[arrayBuffer] is not a function" thrown in grafana/k6.

Source

Thrown at internal/js/modules/k6/websockets/helpers.go:46

	return o.Prototype().Get("constructor") == rt.GlobalObject().Get("Uint8Array")
}

func isDataView(o *sobek.Object, rt *sobek.Runtime) bool {
	return o.Prototype().Get("constructor") == rt.GlobalObject().Get("DataView")
}

func isBlob(o *sobek.Object, blobConstructor sobek.Value) bool {
	return o.Prototype().Get("constructor") == blobConstructor
}

func isObject(val sobek.Value) bool {
	return val != nil && val.ExportType() != nil && val.ExportType().Kind() == reflect.Map
}

func extractBytes(o *sobek.Object, rt *sobek.Runtime) []byte {
	arrayBuffer, ok := sobek.AssertFunction(o.Get("arrayBuffer"))
	if !ok {
		common.Throw(rt, errors.New("Blob.[arrayBuffer] is not a function"))
	}

	buffer, err := arrayBuffer(sobek.Undefined())
	if err != nil {
		common.Throw(rt, fmt.Errorf("call to Blob.[arrayBuffer] failed: %w", err))
	}

	p, ok := buffer.Export().(*sobek.Promise)
	if !ok {
		common.Throw(rt, errors.New("Blob.[arrayBuffer] return is not a Promise"))
	}

	ab, ok := p.Result().Export().(sobek.ArrayBuffer)
	if !ok {
		common.Throw(rt, errors.New("Blob.[arrayBuffer] promise's return is not an ArrayBuffer"))
	}

	return ab.Bytes()

View on GitHub (pinned to 93accf6570)

When it happens

Trigger: Thrown at internal/js/modules/k6/websockets/helpers.go:46 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/bb7d21ad790e1184. Report an issue: GitHub.