React Native Solana Magic RPC Error: [-32603] Internal error: Expected Buffer
See original GitHub issue✅ Prerequisites
- Did you perform a cursory search of open issues? Is this bug already reported elsewhere? https://github.com/magiclabs/magic-js/issues/87
- Are you running the latest SDK version?
- Are you reporting to the correct repository (
magic-sdk
)?
🐛 Description
When Signing Solana Transactions in a React Native app the RPC request will fail with the error:
LOG {"feePayer":"3QbZSyrxLsh3Jcuo5Xr5opoCeV5NfruBy8SVGHFVxGy2","instructions":[{"keys":[{"pubkey":"3QbZSyrxLsh3Jcuo5Xr5opoCeV5NfruBy8SVGHFVxGy2","isSigner":true,"isWritable":false},{"pubkey":"QfX7iD47JbWHvZAo4ByFm6BVq7dePr16Z9bEfzTCska","isSigner":false,"isWritable":true}],"programId":"76vzBwHg7GYZc6uKyzKvQb9NoZeALMvBVGdS5VJrcLs7","data":{"type":"Buffer","data":[3,218,52,49,1,41,52,49,1,5,54,49,1,177,50,49,1,52,47,49,1,55,52,49,1,175,50,49,1,82,54,49,1,0,0,0,0,0,0]}}],"recentBlockhash":"2hUMXihEUHrUsJb81ogtDdtd1FGWTdW7vhijNh1nWF6g","serializeConfig":{"requireAllSignatures":false,"verifySignatures":true}}
ERROR [Error: Magic RPC Error: [-32603] Internal error: Expected Buffer]
🧩 Steps to Reproduce
- Create a React Native App
- Attempt to sign any solana transaction (transfer from the docs works well): https://magic.link/docs/advanced/blockchains/solana#sign-transaction
- Attempt to actually run that code and it will fail.
🤔 Expected behavior
The transaction should be signed successfully.
😮 Actual behavior
The transaction fails with the error ERROR [Error: Magic RPC Error: [-32603] Internal error: Expected Buffer]
💻 Code Sample
It is really good to note that this EXACT same code works in a web browser with no problems. So this is an issue that is specific to React Native. I know to get Buffer there needs to be a use of polyfills, so my guess is the polyfills do not line up even thought they both serialize to the same JSON string/structure. Would love to get a workaround for this issue ASAP.
signTransaction: async (transaction) => {
const serializeConfig = {
requireAllSignatures: false,
verifySignatures: true,
};
return (
await magic.solana.signTransaction(
transaction,
serializeConfig
)
).rawTransaction;
},
};
🌎 Environment
Software | Version(s) |
---|---|
@magic-sdk/react-native |
7.0.0 |
@magic-ext/solana |
3.0.1 |
Browser | react native |
yarn |
1.22.17 |
Operating System | ios 15 |
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
React Native Solana Magic RPC Error: [-32603] Internal error
Attempt to actually run that code and it will fail. Expected behavior. The transaction should be signed successfully. Actual behavior. The transaction ...
Read more >Failed gas estimation causes JSON-RPC error -32603 #7286
The fix is to specify the gasLimit in the code. As such, I believe that this is either a bug in Ganache's gas...
Read more >Tips to handle Internal JSON RPC error on MetaMask
If Internal JSON 32603 error appears, it means the MetaMask is going through difficulty in detecting the error. In this article, we are...
Read more >Phantom - RPC Error: Something went wrong -32603
I try to sign a text and I get this error. const anchorWallet = useAnchorWallet(); const MEMO_PROGRAM_ADDRESS ...
Read more >How to Build a Full Stack NFT Marketplace - V2 (2022)
Building an NFT marketplace with Next.js, Tailwind, Solidity, and Polygon. ... Object { code: -32603, message: "Internal JSON-RPC error.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If it does not involve extra complexity, I think I can wrap it up this week.
Hey @Ethella @smithki
I am testing this fix using the demo application that I created and shared in the ticket. Even after pulling in
"@magic-sdk/react-native": "8.1.0"
and"@magic-ext/solana": "4.0.1"
I am still getting the exact name issue.