@@ -51,6 +51,12 @@ export const triggerFirstInvocation = async <TInitialPayload>({
51
51
telemetry,
52
52
} ) ;
53
53
54
+ // QStash doesn't forward content-type when passed in `upstash-forward-content-type`
55
+ // so we need to pass it in the headers
56
+ if ( workflowContext . headers . get ( "content-type" ) ) {
57
+ headers [ "content-type" ] = workflowContext . headers . get ( "content-type" ) ! ;
58
+ }
59
+
54
60
if ( useJSONContent ) {
55
61
headers [ "content-type" ] = "application/json" ;
56
62
}
@@ -251,9 +257,9 @@ export const handleThirdPartyCallResult = async ({
251
257
if ( ! failingStep )
252
258
throw new WorkflowError (
253
259
"Failed to submit the context.call. " +
254
- ( steps . length === 0
255
- ? "No steps found."
256
- : `No step was found with matching messageId ${ messageId } out of ${ steps . length } steps.` )
260
+ ( steps . length === 0
261
+ ? "No steps found."
262
+ : `No step was found with matching messageId ${ messageId } out of ${ steps . length } steps.` )
257
263
) ;
258
264
259
265
callbackPayload = atob ( failingStep . body ) ;
@@ -280,8 +286,8 @@ export const handleThirdPartyCallResult = async ({
280
286
// this callback will be retried by the QStash, we just ignore it
281
287
console . warn (
282
288
`Workflow Warning: "context.call" failed with status ${ callbackMessage . status } ` +
283
- ` and will retry (retried ${ callbackMessage . retried ?? 0 } out of ${ callbackMessage . maxRetries } times).` +
284
- ` Error Message:\n${ atob ( callbackMessage . body ?? "" ) } `
289
+ ` and will retry (retried ${ callbackMessage . retried ?? 0 } out of ${ callbackMessage . maxRetries } times).` +
290
+ ` Error Message:\n${ atob ( callbackMessage . body ?? "" ) } `
285
291
) ;
286
292
return ok ( "call-will-retry" ) ;
287
293
}
@@ -498,11 +504,11 @@ export const getHeaders = ({
498
504
// to include telemetry headers:
499
505
...( telemetry
500
506
? Object . fromEntries (
501
- Object . entries ( getTelemetryHeaders ( telemetry ) ) . map ( ( [ header , value ] ) => [
502
- header ,
503
- [ value ] ,
504
- ] )
505
- )
507
+ Object . entries ( getTelemetryHeaders ( telemetry ) ) . map ( ( [ header , value ] ) => [
508
+ header ,
509
+ [ value ] ,
510
+ ] )
511
+ )
506
512
: { } ) ,
507
513
// note: using WORKFLOW_ID_HEADER doesn't work, because Runid -> RunId:
508
514
"Upstash-Workflow-Runid" : [ workflowRunId ] ,
@@ -540,8 +546,8 @@ export const verifyRequest = async (
540
546
} catch ( error ) {
541
547
throw new WorkflowError (
542
548
`Failed to verify that the Workflow request comes from QStash: ${ error } \n\n` +
543
- "If signature is missing, trigger the workflow endpoint by publishing your request to QStash instead of calling it directly.\n\n" +
544
- "If you want to disable QStash Verification, you should clear env variables QSTASH_CURRENT_SIGNING_KEY and QSTASH_NEXT_SIGNING_KEY"
549
+ "If signature is missing, trigger the workflow endpoint by publishing your request to QStash instead of calling it directly.\n\n" +
550
+ "If you want to disable QStash Verification, you should clear env variables QSTASH_CURRENT_SIGNING_KEY and QSTASH_NEXT_SIGNING_KEY"
545
551
) ;
546
552
}
547
553
} ;
0 commit comments