grafana/k6 · error
k6/experimental/webcrypto has been graduated and it's now gl
Error message
k6/experimental/webcrypto has been graduated and it's now globally available as defined by standard WebAPIs. You just need to remove the import.
What it means
k6/experimental/webcrypto graduated: the Web Crypto API (crypto.subtle, etc.) is now globally available as defined by the WebAPIs, so the experimental module was removed and its import throws this stub error.
Source
Thrown at internal/js/jsmodules.go:107
// external is always prefixed with `k6/x`
for _, e := range external {
result[e.Name] = e.Module
}
return result
}
type removedModule struct {
errMsg string
}
func newRemovedModule(errMsg string) modules.Module {
return &removedModule{errMsg: errMsg}
}
func (rm *removedModule) NewModuleInstance(vu modules.VU) modules.Instance {
common.Throw(vu.Runtime(), errors.New(rm.errMsg))
return nil
}
type warnExperimentalModule struct {
once sync.Once
msg string
base modules.Module
}
func newWarnExperimentalModule(base modules.Module, msg string) modules.Module {
return &warnExperimentalModule{
msg: msg,
base: base,
}
}
func (w *warnExperimentalModule) NewModuleInstance(vu modules.VU) modules.Instance {View on GitHub (pinned to 93accf6570)
Solutions
- Delete the import and use the global `crypto` object directly (crypto.subtle.digest, etc.)
- No call-site changes are needed — only the import line goes away
Example fix
// before
import { crypto } from 'k6/experimental/webcrypto';
const hash = await crypto.subtle.digest('SHA-256', data);
// after
const hash = await crypto.subtle.digest('SHA-256', data); Defensive patterns
Strategy: validation
Validate before calling
grep -rn "k6/experimental/webcrypto" . --include='*.js' && { echo 'webcrypto is global now — delete the import' >&2; exit 1; } || true Prevention
- Use the global `crypto` / `crypto.subtle` directly in new code
- Remove leftover polyfill imports when upgrading k6
When it happens
Trigger: `import { crypto } from 'k6/experimental/webcrypto'` (or default import) on a current k6 build.
Common situations: Older crypto-using scripts (subtle.digest, generateKey) that imported the polyfill explicitly; snippets copied from pre-graduation docs.
Related errors
- k6/experimental/redis has been removed. Please migrate to th
- k6/experimental/browser has been graduated, please use k6/br
- k6/experimental/grpc has been graduated, please use k6/net/g
- k6/experimental/timers has been graduated, and it's now glob
- k6/experimental/tracing has been removed. All of it function
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/dc876812fc808b24.
Report an issue: GitHub.