Trouble with conducting a simple transaction via Vanilla JS

My code used to work a couple of months ago. It used to be a simple transaction from wallet to another through a click of a button and then it just stopped working as I was dealing with something called ā€œbufferā€. Itā€™s been really annoying and very hard to find a solution to this even though Iā€™ve been looking for ages. Apparently, the reason why this is happening is because the bundle given by the Solana documentation itself does not contain all of the dependencies which is a big issue.

What am I supposed to do in this case? Would appreciate it if someone can help me figure this is outā€¦

What is the error(s) you get? Can you give more info about your project (like package.json dependencies) and the transaction code.

Do you have any other socials in order for me to contact you as itā€™d be easier? I use a bundle through my HTML page which is why I donā€™t have a package.json file, and the dependencies are there but fail to function for some reason.

I can connect my wallet but nothing else works especially when Iā€™m attempting to fetch the userā€™s balance or the latest blockhash for the transaction.

This is the error I receive: Error: 403 : {"jsonrpc":"2.0","error":{"code": 403, "message":"Access forbidden, contact your app developer or [email protected]."}

This is the bundle I use which previously worked but stopped working recently around 2 weeks ago.

https://unpkg.com/@solana/web3.js@latest/lib/index.iife.js

I donā€™t know how to fix this but I think itā€™s the bundle Iā€™m using, is there a browserified version of @solana/web3.js? All Iā€™m doing is fetching the userā€™s balance, logging it in the console, and prompting a SOL transaction.

Check the version history for this package and try to find the previous version that you were using when it worked - it may have updated with a breaking change. You should be using a specific CDN version.

Scratch thatā€¦ How would I be able to implement a simple SOL transaction from one wallet to another via Vanilla JS with the new update?

I keep on getting a 403 error from the API, not sure why.

https://api.mainnet-beta.solana.com/ 403

I was messing around and it works on devnet but not mainnet-betaā€¦ It has something to do with the API. Any help?

that 403 error could be a forbidden error

An HTTP 403 response code means that a client is forbidden from accessing a valid URL.

meaning that it may require some authentication?

Itā€™s a public API, I donā€™t get why itā€™d ask for authentication. Iā€™ve seen other code and they use the same functions. All I did was use getBalance which is nothing crazy. Itā€™s definitely the bundle Iā€™m using or something, honestly a newbie but it used to work in early November!

As I said, is there any way I can remake this?

My goal is to connect to my website with a button which is simple, Iā€™ve aleady done that but I canā€™t access the Solana API through a bundle which is actually public to everyone. I retrieve the userā€™s address, balance, and then prompt a transaction using Vanilla JS. I donā€™t want to use wallet-adapter or whatever itā€™s called, would like to stick to Phantom to keep it simple. I just donā€™t know why my code isnā€™t working anymore and itā€™s probably because I need an updated version of @solana/web3.js that is within a bundle.

did you check in network tab to see if there is more info for that 403 error?

Commitment has been confirmed but not authorized to make the request? Would you like to check the code yourself? and do you have any other socials I can contact you through? (like Discord)

I donā€™t know how to check the code

You can check the Solana docs for current SDK usage. You can also ask these questions in the Solana Discord.