ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

Browser hangup during create method #4171

Closed metrocoding closed 1 year ago

metrocoding commented 2 years ago

Hi, my browser is freezing till create promise is resolved in then. only firefox, its ok on Safari and Chrome


<script src="https://cdn.jsdelivr.net/npm/ipfs-core@0.15.4/dist/index.min.js" integrity="sha256-BOLUCfwJIrl77f7h7q0mPaoJsOOrc+eE/i+XqTQSIJM=" crossorigin="anonymous"></script>

<script>
let ipfsNode = null;
const Ipfs = window.IpfsCore;
document.addEventListener("DOMContentLoaded", async () => {
    Ipfs.create().then(n => {
    // about 26000ms
        ipfsNode = n;
    });
});

  const  saveMetaData = async (metaData) => {
        try {
            //const ipfsNode = await Ipfs.create();
            const result = await ipfsNode.add(JSON.stringify(metaData));
            return result.path;
        } catch (e) {
            console.error("Error saving metadata to IPFS", e);
            return null;
        }
    }

</script>

Severity:

Medium

welcome[bot] commented 2 years ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

legalizemath commented 2 years ago

unless I'm missing something

const saveMetaData: async (metaData) => { should probably be const saveMetaData = async (metaData) => {

metrocoding commented 2 years ago

unless I'm missing something

const saveMetaData: async (metaData) => { should probably be const saveMetaData = async (metaData) => {

I just made mistake in here by : instead of = But it's fine in my real code the problem is with creat method only in firefox

SgtPooki commented 1 year ago

js-ipfs is being deprecated in favor of Helia. You can https://github.com/ipfs/js-ipfs/issues/4336 and read the migration guide.

Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterward (see https://github.com/ipfs/js-ipfs/issues/4336).

This issue is most likely resolved in Helia, please try it out!