Skip to content

Library-generated Promises cannot be passed down to Next.js Client Components as props, triggering error #2188

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

Open
1 task
rubin-alldev opened this issue Mar 4, 2025 · 0 comments
Labels
bug Something isn't working openapi-fetch Relevant to the openapi-fetch library

Comments

@rubin-alldev
Copy link

rubin-alldev commented Mar 4, 2025

openapi-fetch version

0.13.4

Description

Hi there. I appreciate this lib very much, it has enabled me to bootstrap numerous APIs with ease and saved a lot of time.

Now I am trying to use it in a Next.js (v.14) project, but encountered a problem: promises, returned from the API client calls, can't be accepted as props to the underlying Client Components, triggering the following error: "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported".
At the same time, Promises obtained from the equivalent fetch calls go through successfully.

I'd like to know whether I've overlook something in the docs stating this limitation, or this may be fixed.

Reproduction

https://codesandbox.io/p/devbox/vy37yx (swap client call for fetch call in page.tsx to remove the error)

Expected result

Promise from the lib is correctly passed down to the Client Component

Extra

@rubin-alldev rubin-alldev added bug Something isn't working openapi-fetch Relevant to the openapi-fetch library labels Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openapi-fetch Relevant to the openapi-fetch library
Projects
None yet
Development

No branches or pull requests

1 participant