{"record":{"id":"2ece2f7d8e1aa5e6","repo":"grafana/k6","slug":"creating-request-w","errorCode":null,"errorMessage":"creating request: %w","messagePattern":"creating request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/storage/file_persister.go","lineNumber":138,"sourceCode":"\treturn nil\n}\n\n// requestPresignedURL will request a new presigned URL from the remote server\n// and returns a [PresignedURLResponse] that contains the presigned URL details.\nfunc (r *RemoteFilePersister) requestPresignedURL(ctx context.Context, path string) (PresignedURLResponse, error) {\n\tb, err := buildPresignedRequestBody(r.basePath, path)\n\tif err != nil {\n\t\treturn PresignedURLResponse{}, fmt.Errorf(\"building request body: %w\", err)\n\t}\n\n\treq, err := http.NewRequestWithContext(\n\t\tctx,\n\t\thttp.MethodPost,\n\t\tr.presignedURLRequestURL,\n\t\tbytes.NewReader(b),\n\t)\n\tif err != nil {\n\t\treturn PresignedURLResponse{}, fmt.Errorf(\"creating request: %w\", err)\n\t}\n\n\tfor k, v := range r.headers {\n\t\treq.Header.Add(k, v)\n\t}\n\n\tresp, err := r.httpClient.Do(req) //nolint:gosec\n\tif err != nil {\n\t\treturn PresignedURLResponse{}, fmt.Errorf(\"performing request: %w\", err)\n\t}\n\tdefer resp.Body.Close() //nolint:errcheck\n\n\tif err := checkStatusCode(resp); err != nil {\n\t\treturn PresignedURLResponse{}, err\n\t}\n\n\treturn readPresignedURLResponse(resp)\n}","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/storage/file_persister.go#L120-L156","documentation":"Raised in requestPresignedURL when http.NewRequestWithContext fails to build the POST request to the presigned-URL endpoint from the JSON body. Since the URL comes from configuration, this fires when the configured presignedURLRequestURL is not a valid/parseable URL (bad scheme, control characters) or the context is already canceled — a configuration-level failure rather than a network one.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/storage/file_persister.go:138 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the cloud/presigned endpoint URL configuration for typos or invalid characters","Ensure the URL has a valid scheme (https://)","Verify the execution context is not already canceled before uploading artifacts"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}