Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Production Event .send is sending request to Dev Environment #730

Open
abe17124 opened this issue Oct 26, 2024 · 4 comments
Open

[BUG] Production Event .send is sending request to Dev Environment #730

abe17124 opened this issue Oct 26, 2024 · 4 comments

Comments

@abe17124
Copy link

abe17124 commented Oct 26, 2024

Describe the bug
I have a NextJS application hosted on Vercel, and synced with Inngest with the auto integration and have confirmed it works correctly (able to invoke functions through Inngest dashboard or Cron). I am trying to .send() to trigger an existing function, however, I am seeing two issues in the production deployment:
1.) .send() Request URL is pointing to localhost (127.0.0.0:/dev)
2.) NO_EVENT_KEY_SET Error occurring even though it was automatically set in Env Variables on Vercel (I verified)

This Production deployment error clears when I run the Inngest dev client server locally, which seems broken given production is connection to a localhost.

I also have no issues running the app locally + using Inngest locally, if that matters.

To Reproduce
Steps to reproduce the behavior:

  1. Create any simple function (mine returned a simple message)
  2. Create Inngest Client
  3. Send a trigger to .send() event to invoke that function
  4. Run in Production without Dev server init (error occurs)
  5. Run again with dev server init (no error)

Expected behavior
I expect the production deployment to hit the /api/inngest route, and invoke the function there using the INNGEST_EVENT_KEY autoset in the Env variables on Vercel.

Code snippets / Logs / Screenshots
"Dev" Request going to localhost:
image
image

NO_EVENT_KEY_ERROR:
Note, origin URL is correct (production URL), and X-Inngest-Server-Kind value is cloud (which also seems correct)
image

Seems to error out here:
image

  • Initiator Chain:
    image
    image

System info (please complete the following information):

  • OS: Windows
  • npm package Version : ^3.22.4
  • Framework [e.g. Next.js, Express]: NextJS v14.2.12
  • Platform [e.g. Vercel, AWS Lambda]: Vercel
Copy link

linear bot commented Oct 26, 2024

@abe17124
Copy link
Author

abe17124 commented Oct 28, 2024

Update: I did try forcing INGGEST_DEV to 0 Env Var in Vercel just for the production branch. It still does not fix it, same issue present :(. Would love to get some help on this as this has rendered our app unusable and we're unable to support customers.

I'm also unable to delete and re-add the project into Inngest, as there's only an "Archive/Unarchive" option

@jpwilliams
Copy link
Member

Hi @abe17124! 👋

Does indeed sound like your app's just not picking up any environment variables. Could I ask a couple more questions?

  1. The specific package version used - the output of npm ls inngest or pnpm ls inngest should show this
  2. Did this issue start suddenly? It sounds like you were already in production; did you update the package?
  3. Are you using the Pages Router or App Router in Next.js?
  4. Where is the Inngest client (i.e. new Inngest()) instantiated? Would be good to see both the file path and code used to instantiate

@abe17124
Copy link
Author

abe17124 commented Nov 1, 2024

Hey Jack!
Thanks for the reply, I actually ended up fixing it and as much as I hate to admit it, it was a noob mistake ha. I was doing .send funcs unknowingly from the client side, so .env var's weren't seen. I moved the calls to a middleware server actions file to call Inngest and it's working perfectly now :)

And for context, it did not start suddenly, this was the first time I had invoked a func from within code (all other times, I just used cron jobs), so first time exposing myself to the error that was always there.

I think maybe a small improvement opportunity would be to clarify the Error message to mention "check env variable's/which env the func is being invoked" when running in Prod since Inngest just defaults to the Dev enviroment if the var's don't exist (which was just a red herring, and not the issue).

Thanks again, also love Inngest!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants