DeployKit

Errors

What can fail, which method can fail with what, and what to do about it.

Every error has a _tag. The Promise API throws them; with Effect they're typed in the error channel.

ErrorMeansDo
ProviderErrorThe host rejected the request, or its outcome is unknownCheck recovery, below
ValidationErrorInvalid input: a bad option, manifest or fileFix the input
UnsupportedErrorThis provider can't do thatCheck capabilities
SourceErrorReading a file from its source failedCheck the source; safe to retry
IntegrityErrorA file's bytes didn't match its declared size or hashRebuild the manifest
TransferLimitErrorA file or the artifact is over a limitShrink it or raise a budget
DeploymentTimeoutErrorPolling ended before a terminal statusContinue observing the saved deployment
DeploymentFailedErrordeployAndWait observed a failed deploymentInspect the provider failure and saved intent
AbortErrorCancelled by your AbortSignal (Promise API)Inspect possible create outcome
ClientClosedErrorCalled after close() (Promise API)Use an open client

Which method fails with what

MethodCan fail with
createApp, getApp, deleteApp, getDeploymentProviderError
findAppByName, setAccess, activateDeployment, getActivation, reconcileDeployment, listDeployments, deleteDeployment, rollbackProviderError, UnsupportedError
deployProviderError, UnsupportedError, ValidationError, SourceError, IntegrityError, TransferLimitError
deployDirectoryAs deploy, plus file system errors reading the directory and InvalidArtifactPathError
deployManifestAs deploy; an invalid manifest is a ValidationError

The Promise client can also throw AbortError and ClientClosedError from every method.

ProviderError

recovery tells you what to do next.

import { Effect } from "effect"
import { Deploykit } from "@deploykit/core"

const publish = Effect.gen(function* () {
  const deploykit = yield* Deploykit.Deploykit
  return yield* deploykit.deploy(appId, artifact)
}).pipe(
  Effect.catchTag("ProviderError", error =>
    error.recovery === "retry" ? retryLater(error) : Effect.fail(error)
  )
)
FieldMeaning
recoveryretry, reconcile or fix-input. May be absent when deploykit can't tell
outcomerejected (nothing happened), unknown (it may have happened), observation-failed (a read failed)
operationWhich call failed, e.g. createDeployment
providerWhich provider raised it
statusCode, codeHTTP status and the host's error code
requestIdThe host's request id, for support tickets
retryAfterMsHow long the host asked you to wait
appId, deploymentIdWhat it was working on, when known

Unknown outcomes

If the connection drops after the host received a create request, deploykit can't know whether a deployment exists. You get outcome: "unknown", recovery: "reconcile".

Don't just deploy again, or you may end up with two. On Vercel, reconcile it. On Cloudflare Pages, check the project's deployments before retrying.

Built-in retries

RequestRetried?
Reads (getApp, getDeployment, ...)Up to 4 attempts, exponential backoff from 250 ms, respecting Retry-After
File uploadsSame. Uploads are addressed by content, so repeating one is harmless
Creating a deploymentNever, not even after a 429, because repeating it could duplicate it
Activating a deploymentNever

Change it with retry on the client: { attempts: 1 } turns retries off, and baseDelay sets the first backoff. Each HTTP operation, retries included, times out after 30 seconds; change it with timeoutMs.

Sending errors between processes

Provider.encodeFailure(error) turns an error into versioned JSON and Provider.decodeFailure(json) turns it back with its tag and fields. Useful when a worker reports to a coordinator.

import { Provider } from "@deploykit/core"

const json = Provider.encodeFailure(error) // Effect<string>, in the worker
const same = Provider.decodeFailure(text) // Effect<Failure>, in the coordinator

Provider response diagnostics are allowlisted, but source errors and filesystem errors can include paths. For external telemetry, use deploykit's sanitized events rather than logging arbitrary error objects.

Last updated on

On this page