Skip to content

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

Open

Description

@rubin-alldev

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

Activity

  1. added
    bugSomething isn't working
    openapi-fetchRelevant to the openapi-fetch library
    on Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopenapi-fetchRelevant to the openapi-fetch library

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions