You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HI all we are using hono on vercel. Everything in development (using npx @upstash/qstash-cli dev as server) works well. BUt when I try the same setup in perview the following exception is getting thrown:
Belwo the the full print:
{"level":50,"time":1743859535563,"pid":4,"hostname":"169.254.14.73","err":{"type":"TypeError","message":"Cannot use 'in' operator to search for 'QSTASH_TOKEN' in undefined","stack":"TypeError: Cannot use 'in' operator to search for 'QSTASH_TOKEN' in undefined\n at Array.handler (file:///var/task/node_modules/.pnpm/@upstash[email protected][email protected]/node_modules/@upstash/workflow/hono.mjs:19:27)\n at #dispatch (file:///var/task/node_modules/.pnpm/[email protected]/node_modules/hono/dist/hono-base.js:181:38)\n at Hono.fetch (file:///var/task/node_modules/.pnpm/[email protected]/node_modules/hono/dist/hono-base.js:207:26)\n at Object. (file:///var/task/node_modules/.pnpm/[email protected]/node_modules/hono/dist/adapter/vercel/handler.js:3:14)\n at u. [as handlerWeb] (/opt/rust/nodejs.js:16:18418)\n at Object.handler (/opt/rust/nodejs.js:2:13474)\n at /opt/rust/nodejs.js:2:1565\n at Server. (/opt/rust/nodejs.js:2:11070)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async Server. (/opt/rust/nodejs.js:16:5739)"},"msg":"Cannot use 'in' operator to search for 'QSTASH_TOKEN' in undefined"}
Hi there, it looks like context.env field becomes undefined when Hono is used with Vercel. We will look into why this is the case and how it can be addressed.
It looks like context.env is only defined in Cloudflare Workers. https://hono.dev/docs/api/context#env
When the serve method from hono is used in vercel, context.env is undefined which causes an error.
Fixed the issue by checking if context.env is defined and falling back to process.env if it isn't.
Fixes: #91
HI all we are using hono on vercel. Everything in development (using
npx @upstash/qstash-cli dev
as server) works well. BUt when I try the same setup in perview the following exception is getting thrown:Belwo the the full print:
{"level":50,"time":1743859535563,"pid":4,"hostname":"169.254.14.73","err":{"type":"TypeError","message":"Cannot use 'in' operator to search for 'QSTASH_TOKEN' in undefined","stack":"TypeError: Cannot use 'in' operator to search for 'QSTASH_TOKEN' in undefined\n at Array.handler (file:///var/task/node_modules/.pnpm/@upstash[email protected][email protected]/node_modules/@upstash/workflow/hono.mjs:19:27)\n at #dispatch (file:///var/task/node_modules/.pnpm/[email protected]/node_modules/hono/dist/hono-base.js:181:38)\n at Hono.fetch (file:///var/task/node_modules/.pnpm/[email protected]/node_modules/hono/dist/hono-base.js:207:26)\n at Object. (file:///var/task/node_modules/.pnpm/[email protected]/node_modules/hono/dist/adapter/vercel/handler.js:3:14)\n at u. [as handlerWeb] (/opt/rust/nodejs.js:16:18418)\n at Object.handler (/opt/rust/nodejs.js:2:13474)\n at /opt/rust/nodejs.js:2:1565\n at Server. (/opt/rust/nodejs.js:2:11070)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async Server. (/opt/rust/nodejs.js:16:5739)"},"msg":"Cannot use 'in' operator to search for 'QSTASH_TOKEN' in undefined"}
My endpoint looks like this:
I have my QSTASH_TOKEN set
The text was updated successfully, but these errors were encountered: