Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

A bug in randombytes #4361

Closed
ghost opened this issue May 22, 2023 · 2 comments
Closed

A bug in randombytes #4361

ghost opened this issue May 22, 2023 · 2 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@ghost
Copy link

ghost commented May 22, 2023

  • Version:

ipfs-core:"0.18.0"

  • Platform:

chrome 113.0.5672.127

  • Subsystem:

randombytes browser.js

Severity:

High

Description:

Vue code:
`<script setup lang="ts">
import * as IPFS from "ipfs-core";
const ipfslog = async () => {
const ipfs = await IPFS.create();
const { cid } = await ipfs.add("Hello world");
console.log(await ipfs.version())
console.info(cid);
};
</script>

Error: Uncaught ReferenceError: global is not defined at node_modules/randombytes/browser.js (browser.js:16:14)
Code bug in randombytes browser.js line 16 var crypto = global.crypto || global.msCrypto
Browser does not have variable "global"

Steps to reproduce the error:

Run code import * as IPFS from "ipfs-core"; in browser

@ghost ghost added the need/triage Needs initial labeling and prioritization label May 22, 2023
@welcome
Copy link

welcome bot commented May 22, 2023

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:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

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

@achingbrain
Copy link
Member

Please open an issue against randombytes - that is where the error is coming from, though I think you may need to shim window.global = window.globalThis in your vue config somehow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

1 participant