inngest / inngest-js

The developer platform for easily building reliable workflows with zero infrastructure for TypeScript & JavaScript
https://www.inngest.com/
GNU General Public License v3.0
414 stars 41 forks source link

[BUG] Hono Adapter not working on Cloudflare Worker #560

Closed psteinroe closed 4 months ago

psteinroe commented 5 months ago

Describe the bug The Hono adapter does not work when deployed with Cloudflare Workers. All request throw Failed callingurlfrom serve handler when starting to handle request; Invalid URL string.","stack":"TypeError: Failed callingurlfrom serve handler when starting to handle request; Invalid URL string..

The reason is that the hono adapter is building the url from the host header: https://github.com/inngest/inngest-js/blob/f053ef994709441dba20756378d72140811d1cd6/packages/inngest/src/hono.ts#L38

but in Cloudflare, the host does not include the protocol. The Cloudflare adapter therefore adds it manually: https://github.com/inngest/inngest-js/blob/f053ef994709441dba20756378d72140811d1cd6/packages/inngest/src/cloudflare.ts#L38

To fix this, simply replace the url callback from hono with the one in Cloudflare. It would be nice if we could adapt the hono adapter so that it prefixes the protocol to the host if the host does not have it yet.

linear[bot] commented 5 months ago

INN-2989 [BUG] Hono Adapter not working on Cloudflare Worker