Failing Vercel Preview Protection with context.call#164
Failing Vercel Preview Protection with context.call#164tombeckenham wants to merge 7 commits intoupstash:mainfrom
Conversation
…ry; clean up imports in email-analyzer route
|
Hi @tombeckenham, Thanks for bringing this to our attention. The simplest fix to get around this issue is to pass:
const { POST: handler } = serve<string>(async (context) => {
await context.api.openai.call("call", {
baseURL: "https://testing-ma-feat.requestcatcher.com/",
body: {
messages: [],
model: "gpt-3.5-turbo"
},
operation: "chat.completions.create",
token: "sk-xxxx",
})
}, {
qstashClient: new Client({
token: process.env.QSTASH_TOKEN!,
baseUrl: process.env.QSTASH_URL!,
headers: {
'X-Vercel-Protection-Bypass': 'my-custom-value',
'upstash-callback-forward-X-Vercel-Protection-Bypass': 'my-custom-value',
'upstash-failure-callback-forward-X-Vercel-Protection-Bypass': 'my-custom-value'
}
})
})You shouldn't encounter this issue after updating like this. I will look into whether we can simplify this. If I can't find a way, I will update the docs |
e4698ac to
8324682
Compare
|
I can confirm the workaround works - provided I included the headers on the triggerWorkflow call as well as the qstashClient. Any chance you could make vercel support simpler? I now have to add 4x headers to the trigger call and the serve function. I'm about to look at using webhooks for another workflow. Is there an equivilent header to add for that? |
|
I see. I now understand the issue. We are planning to change the trigger logic so that the headers passed in trigger with We are planning to release a fix to resolve this next week. Let us know if you have any questions! |



DO NOT merge
I have modified email-analyzer-o1 to include the recommended setup for Vercel preview protection. This shows that the first 2 workflow steps work, but the context.call steps fail on vercel preview branches