Repository navigation
Fix uploadFile stream error handling, public type exports, and SDK parity - #140
Merged
Merged
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
- uploadFile: attach the FormData/stream error listener for path, stream and Buffer inputs (stream inputs could still crash the process), abort the in-flight request when the body fails, and never destroy a stream the caller owns. - Tests pipe the body like node-fetch does, so they reproduce the uncaught exception on the previous code. - Up-front customer key checks still validate each key but allow an empty list; customerKeyFor rejects it only when a key is needed. - startupSecrets returns a copy, like exposedPorts. - Mark enableWebglFingerprinting as deprecated (the server ignores it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AHarmlessPyro
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SessionsService.uploadFile: Avoid throwing synchronously insidefileStream.on("error")(which caused an uncaught exception in Node.js); check file readability withfs.access(fileInput, R_OK)and reject cleanly withHyperbrowserErroron stream/form errors.NON_RETRYABLE_ERROR_CODES: Add all 6 non-retryable secret error codes (SECRETS_ADMIN_REQUIRED,SECRETS_NOT_CONFIGURED,SECRET_KEY_UNAVAILABLE,SECRET_DECRYPT_FAILED,SECRET_ENVELOPE_INVALID,SECRET_VALUE_INVALID) matchingpython-sdk.SandboxHandle: AddstartupSecretsgetter matchingpython-sdk'ssandbox.startup_secretsproperty and remove unused privateapplyRuntimeSession.src/types/index.ts,src/types/session.ts): Export allweb/crawltypes, missingscrape/batch-scrape types, andSessionRecording/CreateSessionProfile; addpersistNetworkCachetoSessionProfileandduration/proxyDataConsumedtoSession.customerKeyupfront inVaultsService.unwrap,SecretsService.unwrap, andSecretsService.rewrapbefore making network calls; verifycustomerKey.wrap()returns a non-empty string; shallow-cloneparamsinWebsiteExtractTool.runnableinstead of mutatingparams.schemain place.Testing
yarn buildyarn lintyarn test(unit + integration suites)Note
Medium Risk
Changes session file upload behavior, secret/vault preflight validation, and which API errors are retried—mostly hardening, but callers may see different errors or fewer retries on 503 secret failures.
Overview
Bumps
@hyperbrowser/sdkto 1.5.1 and aligns behavior with the Python SDK in several hot paths.SessionsService.uploadFilenow checks path readability withfs.access, attaches FormData/stream error listeners, aborts in-flight uploads on read failures, and races the request against stream errors so Node no longer throws uncaught exceptions from piping a broken body.Customer secrets/vaults gain shared
assertCustomerKeys/wrapEnvelopehelpers: invalid keys are rejected before API calls, empty key lists are allowed only where nothing needs a key, andwrap()must return a non-empty string.SecretsService/VaultsServiceuse these on unwrap/rewrap/upload.BaseServicetreats six additional secret-related API codes as non-retryable (matching Python), even on 503.SandboxHandleexposesstartupSecretsand drops unusedapplyRuntimeSession.Public types export web crawl, batch scrape,
SessionRecording,CreateSessionProfile, and session fields (persistNetworkCache,duration,proxyDataConsumed).WebsiteExtractTool.runnableparses a stringschemaon a shallow clone instead of mutating caller params.Unit tests cover upload edge cases, secret validation, retry codes, and
startupSecrets.Reviewed by Cursor Bugbot for commit e122fda. Bugbot is set up for automated code reviews on this repo. Configure here.