Skip to content

Commit

Permalink
Fix Nuxt and H3 use https when no NODE_ENV (#773)
Browse files Browse the repository at this point in the history
## Summary
Fix the SDK reporting its scheme as `https` when the `NODE_ENV` env var
isn't set.
  • Loading branch information
amh4r authored Dec 9, 2024
1 parent ad6ae39 commit fb745ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-houses-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"inngest": patch
---

Fix Nuxt and H3 uses https in dev
16 changes: 10 additions & 6 deletions packages/inngest/src/h3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ export const serve = (
body: () => readBody(event),
headers: (key) => getHeader(event, key),
method: () => event.method,
url: () =>
new URL(
url: () => {
let scheme = "https";
if ((processEnv("NODE_ENV") ?? "dev").startsWith("dev")) {
scheme = "http";
}

return new URL(
String(event.path),
`${
processEnv("NODE_ENV") === "development" ? "http" : "https"
}://${String(getHeader(event, "host"))}`
),
`${scheme}://${String(getHeader(event, "host"))}`
);
},
queryString: (key) => {
const param = getQuery(event)[key];
if (param) {
Expand Down

0 comments on commit fb745ef

Please sign in to comment.