{"record":{"id":"7c5200a555adcf28","repo":"grafana/k6","slug":"creating-upload-request-w-7c5200","errorCode":null,"errorMessage":"creating upload request: %w","messagePattern":"creating upload request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/storage/file_persister.go","lineNumber":103,"sourceCode":"\t\tpresignedURLRequestURL: presignedURLRequestURL,\n\t\theaders:                headers,\n\t\tbasePath:               basePath,\n\t\thttpClient: &http.Client{\n\t\t\tTimeout: time.Second * 10,\n\t\t},\n\t}\n}\n\n// Persist will upload the contents of data to a remote location.\nfunc (r *RemoteFilePersister) Persist(ctx context.Context, path string, data io.Reader) (err error) {\n\tpsResp, err := r.requestPresignedURL(ctx, path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"requesting presigned url: %w\", err)\n\t}\n\n\treq, err := newFileUploadRequest(ctx, psResp, data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating upload request: %w\", err)\n\t}\n\n\tresp, err := r.httpClient.Do(req) //nolint:gosec\n\tif err != nil {\n\t\treturn fmt.Errorf(\"performing upload request: %w\", err)\n\t}\n\tdefer resp.Body.Close() //nolint:errcheck\n\n\tif _, err := io.Copy(io.Discard, resp.Body); err != nil {\n\t\treturn fmt.Errorf(\"draining upload response body: %w\", err)\n\t}\n\n\tif err := checkStatusCode(resp); err != nil {\n\t\treturn fmt.Errorf(\"uploading: %w\", err)\n\t}\n\n\treturn nil\n}","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/storage/file_persister.go#L85-L121","documentation":"Error \"creating upload request: %w\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/storage/file_persister.go:103 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"}