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

Add `_unsafe_debug` flag to serve options #391

Closed jpwilliams closed 10 months ago

jpwilliams commented 10 months ago

Summary

Adds an _unsafe_debug flag to serve options so that users can debug some finer details around their served functions.

import { functions, inngest } from "@/inngest";
import { serve } from "inngest/next";

export const { GET, POST, PUT } = serve({
  client: inngest,
  functions,
  _unsafe_debug: true,
});

It will log extra data to the console:

_unsafe_debug: _unsafe_debug: { isEdge: true }
_unsafe_debug: Returning isProduction: { isProd: false }
_unsafe_debug: isEdge; returning URL: {
  'req.url': 'http://localhost:3000/api/inngest',
  ret: 'http://localhost:3000/api/inngest'
}
_unsafe_debug: Returning method: { method: 'GET' }
_unsafe_debug: isEdge; returning header: { host: 'localhost:3000' }

It will also provide more details when responding to a GET request:

{
    "message": "Inngest endpoint configured correctly.",
    "hasEventKey": true,
    "hasSigningKey": false,
    "functionsFound": 1,
    "_unsafe_debug": {
        "url": "http://localhost:3000/api/inngest",
        "method": "GET",
        "isProd": false,
        "skipDevServer": false,
        "host-header": "localhost:3000"
    }
}

Checklist

changeset-bot[bot] commented 10 months ago

⚠️ No Changeset found

Latest commit: bd52b85b3bbd8965eedcd825dca9dde033736358

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

inngest-release-bot commented 10 months ago

A user has added the prerelease/inngest label, so this PR will be published to npm with the tag pr-391. It will be updated with the latest changes as you push commits to this PR.

You can install this prerelease version with:

npm install inngest@pr-391

The last release was built and published from bd52b85b3bbd8965eedcd825dca9dde033736358.

jpwilliams commented 10 months ago

Closing - #400 contains the fixes that this helped debug.