{"record":{"id":"dc876812fc808b24","repo":"grafana/k6","slug":"k6-experimental-webcrypto-has-been-graduated-and-i","errorCode":null,"errorMessage":"k6/experimental/webcrypto has been graduated and it's now globally available as defined by standard WebAPIs. You just need to remove the import.","messagePattern":"k6/experimental/webcrypto has been graduated and it's now globally available as defined by standard WebAPIs\\. You just need to remove the import\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/jsmodules.go","lineNumber":107,"sourceCode":"\n\t// external is always prefixed with `k6/x`\n\tfor _, e := range external {\n\t\tresult[e.Name] = e.Module\n\t}\n\n\treturn result\n}\n\ntype removedModule struct {\n\terrMsg string\n}\n\nfunc newRemovedModule(errMsg string) modules.Module {\n\treturn &removedModule{errMsg: errMsg}\n}\n\nfunc (rm *removedModule) NewModuleInstance(vu modules.VU) modules.Instance {\n\tcommon.Throw(vu.Runtime(), errors.New(rm.errMsg))\n\n\treturn nil\n}\n\ntype warnExperimentalModule struct {\n\tonce sync.Once\n\tmsg  string\n\tbase modules.Module\n}\n\nfunc newWarnExperimentalModule(base modules.Module, msg string) modules.Module {\n\treturn &warnExperimentalModule{\n\t\tmsg:  msg,\n\t\tbase: base,\n\t}\n}\n\nfunc (w *warnExperimentalModule) NewModuleInstance(vu modules.VU) modules.Instance {","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/jsmodules.go#L89-L125","documentation":"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.","triggerScenarios":"`import { crypto } from 'k6/experimental/webcrypto'` (or default import) on a current k6 build.","commonSituations":"Older crypto-using scripts (subtle.digest, generateKey) that imported the polyfill explicitly; snippets copied from pre-graduation docs.","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"],"exampleFix":"// before\nimport { crypto } from 'k6/experimental/webcrypto';\nconst hash = await crypto.subtle.digest('SHA-256', data);\n\n// after\nconst hash = await crypto.subtle.digest('SHA-256', data);","handlingStrategy":"validation","validationCode":"grep -rn \"k6/experimental/webcrypto\" . --include='*.js' && { echo 'webcrypto is global now — delete the import' >&2; exit 1; } || true","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the global `crypto` / `crypto.subtle` directly in new code","Remove leftover polyfill imports when upgrading k6"],"tags":["javascript","modules","webcrypto","migration","removed-feature"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}