Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

TypeError: blocks.map is not a function #21

Closed
ceslabdocker opened this issue Nov 26, 2019 · 6 comments
Closed

TypeError: blocks.map is not a function #21

ceslabdocker opened this issue Nov 26, 2019 · 6 comments

Comments

@ceslabdocker
Copy link

Hi Team,
We are getting the following error while executing the example index.js.
(node:19572) UnhandledPromiseRejectionWarning: TypeError: blocks.map is not a function
at Object.putMany (/home/ubuntu/node_modules/ipfs-repo/src/blockstore.js:92:27)
at Bitswap.putMany (/home/ubuntu/js-datastore-s3/examples/full-s3-repo/node_modules/ipfs-bitswap/src/index.js:282:28)
at Bitswap.put (/home/ubuntu/js-datastore-s3/examples/full-s3-repo/node_modules/ipfs-bitswap/src/index.js:269:17)
at BlockService.put (/home/ubuntu/js-datastore-s3/examples/full-s3-repo/node_modules/ipfs-block-service/src/index.js:61:28)
at IPLDResolver.put (/home/ubuntu/js-datastore-s3/examples/full-s3-repo/node_modules/ipld/src/index.js:196:21)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async loadMfsRoot (/home/ubuntu/js-datastore-s3/examples/full-s3-repo/node_modules/ipfs-mfs/src/core/utils/with-mfs-root.js:34:11)
at async toMfsPath (/home/ubuntu/js-datastore-s3/examples/full-s3-repo/node_modules/ipfs-mfs/src/core/utils/to-mfs-path.js:16:16)
at async mfsStat (/home/ubuntu/js-datastore-s3/examples/full-s3-repo/node_modules/ipfs-mfs/src/core/stat.js:23:9)
(node:19572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside

Please help us to solve this error.

@jacobheun
Copy link
Contributor

@ceslabdocker the example was out of date due to #20. I've created a PR to resolve this, #22, and I believe it should resolve your issue. Can you verify this resolves the problem you're having?

@ceslabdocker
Copy link
Author

Hi Jacobheun, I am using ipfs 0.39.0 and ipfs-repo 0.29.2. But still getting the same error.

@jacobheun
Copy link
Contributor

Can you run npm ls ipfs-repo to see what versions you have?

I noticed in your logs above the error is coming from ipfs-repo in your global installs rather than the local ./node_modules folder.

@ceslabdocker
Copy link
Author

Working fine with the suggested ipfs and ipfs-repo version. But want to understand the purpose of this module. This module description specified as "Datastore implementation with S3 backend". How we can utilize this backend data?

@jacobheun
Copy link
Contributor

The purpose is simply to allow you to leverage S3 as your IPFS datastore instead of using the local filesystem. This is useful when running an IPFS node on EC2 or similar, as you don't have to store data directly on the container. If you don't have a need to keep your data separately from your node, then it might be better to use the filesystem datastore (which is used automatically for node.js implementations).

@ceslabdocker
Copy link
Author

Thanks jacobheun for your help. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants