PatrickAlphaC / nextjs-nft-marketplace-moralis-fcc

44 stars 50 forks source link

🐛 Fix: fix the dependencies version #13

Closed shoaibshebi closed 2 years ago

shoaibshebi commented 2 years ago

Almost 9 people were stuck in this issue till now

🐛 Issue: error: "NoMoralisContextProviderError: Make sure to only call useMoralis within a MoralisProvider"

image

Weired stuff was that if after commenting all the lines of useMoralis(), you will be shocked that error is still there even you commented it

✅ Resolve: I have changed the version of dependencies due to the issue were raising and also linking here the dicussion that how was the issue solved

Links: 👉https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/1786 I've also discussed on Moralis platform: 👉https://forum.moralis.io/t/solved-moralisprovider/18577/3

Thanks

jinsley8 commented 2 years ago

This fix doesn't seem to resolve the issue.

I still get Error [NoMoralisContextProviderError]: Make sure to only call useMoralis within a <MoralisProvider>

Try "moralis": "1.10.0" with

"react-moralis": "^1.3.5",
"web3uikit": "^0.0.133"
shoaibshebi commented 2 years ago

This combination does not work. But the combination that I've told, works in this way


Keep the app running and run this script in another terminal
yarn add react-moralis@latest
refresh app and check, if the issue persists
then run this script yarn add react-moralis@1.3.5
refresh and check

I discussed it with the Moralis team, but even they weren't able to detect what's the issue,

👉https://forum.moralis.io/t/solved-moralisprovider/18577/3

But the way I've suggested is working for me and other folks, you can give it a read here: 👉https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/1786

Thanks @jinsley8 , I would love to answer more questions if you have

jinsley8 commented 2 years ago

This latest Moralis update really messed everything up.

What versions of moralis and react-moralis are actually installed in your lock file?

PatrickAlphaC commented 2 years ago

I think they are right... this should solve issues...

@jinsley8 are you still getting the issue?

shoaibshebi commented 2 years ago

Actually @PatrickAlphaC whenever I upgrade to react-moralis@^1.3.5 and then downgrade to this react-moralis@1.3.5, and refresh, the issue resolves. Its weird but it's working in this way with react-moralis@1.3.5

jinsley8 commented 2 years ago

@PatrickAlphaC @shoaibshebi - if you use react-moralis@^1.3.5 it installs 1.4.1 which needs moralis-v1 to work so the Moralis functions stop working unless you change moralis to moralis-v1 but ConnectButton from web3uikit still stops working either way.

If you do the upgrade/downgrade as @shoaibshebi suggests then it pins two versions in the lockfile but web3uikit still doesn't seem to work:

react-moralis@1.3.5:
  version "1.3.5"
  resolved "https://registry.yarnpkg.com/react-moralis/-/react-moralis-1.3.5.tgz#d811e8c7e16d6ff3988fc2115a6bcce7e85263bd"
  integrity sha512-Z78gjQStR301biEzfJe4MZYGqWZh3bk8hfBzguobWM/98MR7DEBiCCWEEeUqkphc2zkCzo9mKRGV/YTdTdD/vg==
  dependencies:
    fast-deep-equal "^3.1.3"
    immer "^9.0.7"
    use-immer "^0.6.0"

react-moralis@^1.3.5:
  version "1.4.1"
  resolved "https://registry.yarnpkg.com/react-moralis/-/react-moralis-1.4.1.tgz#16885954435719cae923bb1a787455ac4d5d2308"
  integrity sha512-H8ry9JzrJlByE+URUFBe6nbSdD7Yep6fZlRg4YmQELBCVRYIifIKPML5gD8z74tCIYkWrat3Xr3f0Zv7Jy7MYQ==
  dependencies:
    fast-deep-equal "^3.1.3"
    immer "^9.0.7"
    use-immer "^0.6.0"

I still can't find any combo of moralis and react-moralis versions that are working with web3uikit.

This is the latest issue about it, they don't have time to fix it or look into it at the moment: https://github.com/web3ui/web3uikit/issues/773

shoaibshebi commented 2 years ago

Hmmm

Okay, that's fine. But it's working for me and some others as well.

Hope Moralis team looks at that in the future.

jinsley8 commented 2 years ago

I may just have to add a custom Connect Button in lesson 15 to move forward. Lots of odd issues with Moralis since the update last week.

As an alternative for now in Lesson 15, I've implemented a ConnectButton using wagmi and connectkit: https://docs.family.co/connectkit?utm_source=wagmi-dev#getting-started

Hopefully, this helps others who get stuck.

Dylan-Kentish commented 2 years ago

This combination does not work. But the combination that I've told, works in this way


Keep the app running and run this script in another terminal
yarn add react-moralis@latest
refresh app and check, if the issue persists
then run this script yarn add react-moralis@1.3.5
refresh and check

I discussed it with the Moralis team, but even they weren't able to detect what's the issue,

👉https://forum.moralis.io/t/solved-moralisprovider/18577/3

But the way I've suggested is working for me and other folks, you can give it a read here: 👉smartcontractkit/full-blockchain-solidity-course-js#1786

Thanks @jinsley8 , I would love to answer more questions if you have

This worked for me :)

shoaibshebi commented 2 years ago

Great @Dylan-Kentish

If this method doesn't work for someone, do this

Keep the app running Remove the react-moralis using yarn remove react-moralis reinstall it using yarn add react-moralis@1.3.5

It works pretty fine than previous method

PetyrDzhunov commented 2 years ago

Great @Dylan-Kentish

If this method doesn't work for someone, do this

Keep the app running Remove the react-moralis using yarn remove react-moralis reinstall it using yarn add react-moralis@1.3.5

It works pretty fine than previous method

That worked for me :)

nebelmeerwanderer1 commented 2 years ago

I can get the method to work as well, but is it correct that you have to redo every time you restart the app? That is what I currently have to do.

Also find that the method works with web3uikit@0.0.133 but not with @web3uikit/web3

I hope this is resolved soon..

adityabhattad2021 commented 2 years ago

Hey but the run contract functions Still dosen't work.

shoaibshebi commented 2 years ago

@adityabhattad2021 mention specifically with example , code and pics

adityabhattad2021 commented 2 years ago

This prob here tokenURI returns undefined.

shoaibshebi commented 2 years ago

Please go into the discussion section on this repo: create discussion under Q&A category and mention me in the discussion, we will discuss it there so the other people can also benefit directly

For instant solution: reset metamask, clear chaindata from moralis, , stop node, stop moralis:sync , start node , start moralis:sync and then deploy again , mint and list the nft and check if not work open the issue Thanks

shoaibshebi commented 2 years ago

Please go into the discussion section on this repo https://github.com/smartcontractkit/full-blockchain-solidity-course-js, create discussion under Q&A category and mention me in the discussion, we will discuss it there so the other people can also benefit directly

For instant solution: reset metamask, clear chaindata from moralis, , stop node, stop moralis:sync , start node , start moralis:sync and then deploy again , mint and list the nft and check if not work open the issue Thanks

Hey but the run contract functions Still dosen't work.

adityabhattad2021 commented 2 years ago

Discussion #2068

jinsley8 commented 2 years ago

Issue seems to be fixed now in react-moralis: 1.4.2

react-moralis v1.4.2 changelog

web3uikit issue #773