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

@moralisweb3/next keeps unrelated packages to be run in runtime @solana/buffer-layout and ethereumjs-utils #947

Closed
3 tasks done
hskang9 opened this issue Jan 5, 2023 · 15 comments
Labels
wontfix This will not be worked on

Comments

@hskang9
Copy link

hskang9 commented Jan 5, 2023

New Bug Report

Checklist

Issue Description

@moralisweb3/next requires two external packages to be installed in plain next.js application boilerplate. One is ethereumjs-utils and @solana/buffer-layout. What's worse, @solana/buffer-layout requires deprecated version where it asks index.js file to initialize the Moralis object. Newest version of @solana/buffer-layout somehow replaced from index.js to Layout.js. This is nonsense when its package name is literally buffer-layout, but it is Solana, what do you expect. I hope @moralisweb3/next could put these packages in dev-dependancies as they should not be required to be needed in runtime at all. I am actually surprised as well Moralis team cannot handle dev dependancies on releasing package. Now I see why, you guys are using monorepo. I am forking this.

Steps + code to reproduce

Follow guide in https://docs.moralis.io/authentication-api/how-to-sign-in-with-metamask?utm_source=blog&utm_medium=post&utm_campaign=How%2520to%2520Connect%2520MetaMask%2520to%2520Website%2520with%2520NextJS

Actual Outcome

Screen Shot 2023-01-05 at 3 23 34 PM

Expected Outcome

This should compile without Module not found error.

Environment

Here is my related dependancies for the dapp.

"dependencies": {
    "@moralisweb3/common-evm-utils": "^2.11.0",
    "@moralisweb3/next": "^2.11.0",
    "@solana/buffer-layout": "^4.0.1",
    "@tailwindcss/typography": "0.5.2",
    "ethereumjs-util": "^7.1.5",
    "ethers": "^5.7.2",
    "moralis": "^2.11.0",
    "next": "12.2.5",
    "next-auth": "^4.18.7",
    "postcss": "8.4.12",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-hook-form": "6.15.1",
    "stream": "^0.0.2",
    "tailwindcss": "3.0.23",
    "wagmi": "^0.10.4"
  },

Server

  • Moralis server version: NOT_RELATED

Client

  • Moralis SDK version: 2.11.0
  • Operating system: MAC OS
  • Browser: Google Chrome

Logs

@hskang9 hskang9 changed the title @moralisweb3/next keeps deprecated package @solana/buffer-layout and ethereumjs-utils @moralisweb3/next keeps unrelated packages to be run in runtime @solana/buffer-layout and ethereumjs-utils Jan 5, 2023
@hskang9
Copy link
Author

hskang9 commented Jan 5, 2023

@Juici why would you break Moralis by excluding dependancies when the code needs it?

@Juici
Copy link

Juici commented Jan 5, 2023

@Juici why would you break Moralis by changing the package entry point file?

I didn't? The only contribution I have to @solana/buffer-layout is to fix a type hint.

@hskang9
Copy link
Author

hskang9 commented Jan 5, 2023

oh...? then who manages this repo? whoever did this, renaming an index.js entry point file into Layout.js when the package name literally says buffer-layout, is like Elon making Boring project when there is already an underground tunnel. I don't see anyone who managed this repository could not make issues of this.

@hskang9
Copy link
Author

hskang9 commented Jan 5, 2023

Why can't @solana-labs even check whether their published buffer-layout package has dependancies included after publishing? This is just a terrible job of managing tsconfig.json here. https://github.com/solana-labs/buffer-layout/blob/72946cea49eb999dbdd04281c6946adb873be4f1/tsconfig.json#L18 Why would they use Typescript when they cannot even compile right? Why?? The package has buffer for the dependancy!!

@hskang9
Copy link
Author

hskang9 commented Jan 5, 2023

@jstarry set tsconfig.json's exclude to remove node_modules option then publish on the next version of @solana-labs/buffer-layout or this api will be wrecked. All these breakdowns are happening because of you. solana-labs/buffer-layout@4766279. To Moralis team, I suggest to use js version as the maintainer cannot even manage Typescript compiler configuration from fork.

@ivan-liljeqvist
Copy link
Contributor

@ErnoW and team will check :)

@b4rtaz
Copy link
Collaborator

b4rtaz commented Jan 5, 2023

I'm looking at it.

@b4rtaz
Copy link
Collaborator

b4rtaz commented Jan 5, 2023

I cannot reproduce it. I've tested this demo outside of the SDK repo, and it seems to work properly. Even I've set your dependency list from your first post.

Could you share your version of npm/yarn/node?

@hskang9
Copy link
Author

hskang9 commented Jan 5, 2023

For me, auth worked as well. This is because problem happens when the Moralis api interacts with interacting with Solana's web3.js library.

npm version is 8.19.2
yarn version is 1.22.19
node version is v18.12.1

@hskang9
Copy link
Author

hskang9 commented Jan 5, 2023

I don't think Moralis is related from the error. It is the @solana-labs which created the dependancy not found error. After installing dependancies regarding @solana-labs/buffer-layout, Moralis worked properly.

@hskang9
Copy link
Author

hskang9 commented Jan 5, 2023

We just need to wait for @jstarry to fix his typescript configuration or sever out his package.

@b4rtaz
Copy link
Collaborator

b4rtaz commented Jan 5, 2023

This is because problem happens when the Moralis api interacts with interacting with Solana's web3.js library.

What operation cases this?

I've added useSolPortfolio() and useSolBalance() to the demo app (those methods internally use @solana/web3.js), and still don't see any error.

Could you download the demo and try to run it?

@steveluscher
Copy link

Message received! Solana's happy to help here. I'll work on it with you in solana-labs/buffer-layout#5.

@stale
Copy link

stale bot commented Mar 16, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. for your contributions. If this issue is still affecting you, please leave any comment, and we'll keep it open We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! Thank you.

@stale stale bot added the wontfix This will not be worked on label Mar 16, 2023
@stale
Copy link

stale bot commented Mar 23, 2023

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

@stale stale bot closed this as completed Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

5 participants