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] NextJs 14 and latest versions of package.json: dataProvider is not a function #6036

Closed
vitali-bc opened this issue Jun 11, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@vitali-bc
Copy link

Describe the bug

Hi guys, seems very strange...
Basically I'm usine nextjs headless version with refine and updated all packages.json to latest versions (photo 1)
When run dev it shows me error:
Screenshot 2024-06-11 alle 21 46 19

Screenshot 2024-06-11 alle 21 48 49

Steps To Reproduce

  1. run ncu -u to update all packages
  2. npm i to install
  3. npm run dev

Expected behavior

All must working correctly

Packages

refine/core
refine/simple-rest

Additional Context

No response

@vitali-bc vitali-bc added the bug Something isn't working label Jun 11, 2024
@aliemir
Copy link
Member

aliemir commented Jun 12, 2024

Hey @vitali-bc, just created a new Refine + Next.js project using npm create refine-app@latest:

We have src/providers/data-provider/index.ts file which exports the dataProvider, it seems like your import is also coming from the same location. Exported dataProvider is not a function but an object (a data provider instance).

We also export a dataProvider from @refinedev/simple-rest (also in other data provider packages) which is a function and can be used like the way you do:

import { Refine } from "@refinedev/core";
import dataProvider from "@refinedev/simple-rest";

export function RootLayout() {
  return (
    <Refine
      dataProvider={dataProvider("https://api.fake-rest.refine.dev")}
    >
       ...
    </Refine>
  }
}

In your case, updating the import or updating the usage will resolve the issue.

If this happened after freshly created Refine project, can you share your choices so we can track down the issue 🙏

@vitali-bc
Copy link
Author

vitali-bc commented Jun 12, 2024 via email

@aliemir
Copy link
Member

aliemir commented Jun 12, 2024

Ciao @vitali-bc! I'm having hard time keeping up with the issue here. Does this pop up right after you create the project or does it pop up after you update the dependencies in a currently working project? Does this line added/edited by you or was it like that all along? I'll be happy to help if you can provide a bit more info 🚀

@aliemir aliemir closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants