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] Property does not exist on serve() #340

Closed
ellisio opened this issue Oct 5, 2023 · 3 comments · Fixed by #348
Closed

[BUG] Property does not exist on serve() #340

ellisio opened this issue Oct 5, 2023 · 3 comments · Fixed by #348
Assignees
Labels
Bug Something isn't working 📦 inngest Affects the `inngest` package

Comments

@ellisio
Copy link

ellisio commented Oct 5, 2023

Describe the bug

When upgrading to v3.0.0, we're getting a typing error:

Property 'PUT' does not exist on type '(req: Either<NextApiRequest, NextRequest>, res: NextApiResponse) => Promise<Response | undefined>'.ts(2339)

This is how we have our client defined:

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

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

To Reproduce
Steps to reproduce the behavior:

  1. Install inngest@3.0.0 in a TypeScript NextJS 13 project.
  2. Initialize the client (see above).
  • Note: You can just use an empty functions: [] definition, same thing.

Expected behavior
Should not have a typing error.

Code snippets / Logs / Screenshots
image

System info (please complete the following information):

  • OS: Man/Linux
  • npm package Version: 3.0.0
  • Framework: Next.js
  • Platform: Local, Vercel
@ellisio ellisio added the Bug Something isn't working label Oct 5, 2023
@jpwilliams
Copy link
Member

Thanks for the report, @ellisio! Sorry you've run into this.

A workaround for the moment is to revert the v2 functionality of treating serve() as any:

export const { GET, POST, PUT } = serve(...) as any;

There's a couple of fixes needed here - one is #339 and the other just needs to be an app router integration test! Let me work on that now. 🙂

@ellisio
Copy link
Author

ellisio commented Oct 5, 2023

@jpwilliams Was just in the middle of typing out the as any fix myself, thank you!

@tonyhb
Copy link
Contributor

tonyhb commented Oct 6, 2023

Should be fixed in 3.0.1 - thank you!

@tonyhb tonyhb closed this as completed Oct 6, 2023
@jpwilliams jpwilliams reopened this Oct 6, 2023
jpwilliams added a commit that referenced this issue Oct 6, 2023
## Summary
<!-- Succinctly describe your change, providing context, what you've
changed, and why. -->

Fixes #340, ensuring the return type of `"inngest/next"`'s `serve()` is
correctly inferred.

Fuller integration tests for the app router will come in #341.

## Checklist
<!-- Tick these items off as you progress. -->
<!-- If an item isn't applicable, ideally please strikeout the item by
wrapping it in "~~"" and suffix it with "N/A My reason for skipping
this." -->
<!-- e.g. "- [ ] ~~Added tests~~ N/A Only touches docs" -->

- [ ] ~~Added a [docs PR](https://github.com/inngest/website) that
references this PR~~ N/A
- [ ] ~~Added unit/integration tests~~ N/A #341
- [x] Added changesets if applicable

## Related
<!-- A space for any related links, issues, or PRs. -->
<!-- Linear issues are autolinked. -->
<!-- e.g. - INN-123 -->
<!-- GitHub issues/PRs can be linked using shorthand. -->
<!-- e.g. "- inngest/inngest#123" -->
<!-- Feel free to remove this section if there are no applicable related
links.-->
- Fixes #340
@jpwilliams jpwilliams self-assigned this Nov 17, 2023
@jpwilliams jpwilliams added the 📦 inngest Affects the `inngest` package label Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working 📦 inngest Affects the `inngest` package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants