@@ -22,6 +22,7 @@ export async function queue<TBody = unknown>({
2222 endpoint : endpointProp ,
2323 disableVercelPreviewDeployment = false ,
2424 timeoutSeconds,
25+ failureCallback,
2526 ...request
2627} : {
2728 /**
@@ -41,6 +42,10 @@ export async function queue<TBody = unknown>({
4142 retries ?: number ;
4243 deduplicationId ?: string ;
4344 disableVercelPreviewDeployment ?: boolean ;
45+ /**
46+ * URL to POST to when the job fails
47+ */
48+ failureCallback ?: string ;
4449} ) : Promise < void > {
4550 if ( isLocal ( ) || isSelfHosted ( ) || q === undefined ) {
4651 return undefined ;
@@ -74,7 +79,8 @@ export async function queue<TBody = unknown>({
7479 ...request ,
7580 method : request . method === "HEAD" ? "GET" : request . method ,
7681 headers,
77- timeout : timeoutSeconds ? `${ BigInt ( timeoutSeconds ) } s` : undefined
82+ timeout : timeoutSeconds ? `${ BigInt ( timeoutSeconds ) } s` : undefined ,
83+ failureCallback
7884 } ) ;
7985}
8086
@@ -87,6 +93,7 @@ export async function queueWithMessageId<TBody = unknown>({
8793 method,
8894 timeoutSeconds,
8995 callback,
96+ failureCallback,
9097 ...request
9198} : {
9299 /**
@@ -113,6 +120,10 @@ export async function queueWithMessageId<TBody = unknown>({
113120 * URL to POST to when the job completes (success or failure)
114121 */
115122 callback ?: string ;
123+ /**
124+ * URL to POST to when the job fails
125+ */
126+ failureCallback ?: string ;
116127} ) : Promise < string | undefined > {
117128 if ( isLocal ( ) || isSelfHosted ( ) || q === undefined ) {
118129 return undefined ;
@@ -145,7 +156,8 @@ export async function queueWithMessageId<TBody = unknown>({
145156 headers,
146157 method,
147158 timeout : timeoutSeconds ? `${ BigInt ( timeoutSeconds ) } s` : undefined ,
148- callback
159+ callback,
160+ failureCallback
149161 } ) ;
150162
151163 if ( "messageId" in response ) {
0 commit comments