You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to build a simple test app with OrbitDB, relying only on the browser. This is my code:
import{createOrbitDB}from'@orbitdb/core';import{createLibp2p}from'libp2p';import{createHelia}from'helia';import{identify}from'@libp2p/identify';import{webSockets}from'@libp2p/websockets';import{webRTC}from'@libp2p/webrtc';import{all}from'@libp2p/websockets/filters';import{noise}from'@chainsafe/libp2p-noise';import{yamux}from'@chainsafe/libp2p-yamux';import{gossipsub}from'@chainsafe/libp2p-gossipsub';import{circuitRelayTransport}from'@libp2p/circuit-relay-v2';constcustomConfig={addresses: {listen: ['/webrtc']},transports: [webSockets({filter: all}),webRTC(),circuitRelayTransport({discoverRelays: 1})],connectionEncryption: [noise()],streamMuxers: [yamux()],connectionGater: {denyDialMultiaddr: ()=>false},services: {identify: identify(),pubsub: gossipsub({allowPublishToZeroTopicPeers: true,emitSelf: true})}};exportconstinitNewDb=async(name)=>{constlibp2p=awaitcreateLibp2p({ ...customConfig});constipfs=awaitcreateHelia({ libp2p });constorbitdb=awaitcreateOrbitDB({ ipfs });letmydb=awaitorbitdb.open(name,{type: 'documents'});//return db addressconsole.log(mydb.address);constaddr=mydb.address;returnaddr;}exportconstopenDb=async(address)=>{console.log("opening existing db ",address)constlibp2p=awaitcreateLibp2p({ ...customConfig});constipfs=awaitcreateHelia({ libp2p });constorbitdb=awaitcreateOrbitDB({ ipfs });console.log("just before open");letmydb=awaitorbitdb.open(address);// OPEN DB AND READ DOCSconsole.log("opened mydb",mydb);forawait(constrecordofmydb.iterator()){console.log(record)}}
Basically I use the initNewDB function to create a new db. In another piece of code I'm putting some documents in and everything works as expected.
In another browser instance I'm running the openDb function with the address of the first instance as parameter (e.g. /orbitdb/zdpuAkcwe7f3qrHSwmqKeUa55RJVC4pJxYv6YbYCSVypXUgGc). The function hangs for a while on
letmydb=awaitorbitdb.open(address);
and then in the browser console i get:
Uncaught (in promise) AggregateError: All promises were rejected
the error itself doesn't provide much information and I'm struggling to find some working examples for my case. Is there any configuration problem or is it a bug?
Thanks
The text was updated successfully, but these errors were encountered:
Hi, I'm trying to build a simple test app with OrbitDB, relying only on the browser. This is my code:
Basically I use the
initNewDB
function to create a new db. In another piece of code I'm putting some documents in and everything works as expected.In another browser instance I'm running the
openDb
function with the address of the first instance as parameter (e.g./orbitdb/zdpuAkcwe7f3qrHSwmqKeUa55RJVC4pJxYv6YbYCSVypXUgGc
). The function hangs for a while onand then in the browser console i get:
the error itself doesn't provide much information and I'm struggling to find some working examples for my case. Is there any configuration problem or is it a bug?
Thanks
The text was updated successfully, but these errors were encountered: