Giter Site home page Giter Site logo

filebase-js's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

filebase-js's Issues

`storeBlob` returned CID but object was not stored in the bucket

We use storeBlob to save JSON files to IPFS. Recently we had a case where several of our pins using storeBlob returned CID but the file was not uploaded to bucket and not announced to DHT. We repinned the same content and it was eventually correctly uploaded to filebase s3 bucket and announced to DHT.

When looking at code, storeBlob returns CID that is returned from encodeBlob, so there's no guarantee that it was actually uploaded, and my immediate reaction was that this is the cause of this issue, however, after closer inspection, I can see that on the next like there's await FilebaseClient.storeCar(service, car, objectName || cid.toString()), which should throw and error if CID is not returned from filebase server, which shows immediately go to catch clause and call await blockstore.close() instead of returning CID.

So I am puzzled how this happened that CID was returned but the file was not uploaded to the bucket, I was going to submit this simple fix (see screenshot below), but cannot understand why it would be needed as storeCar promise should throw if there's no CID returned in carHeader.Metadata['cid']

image

Error when imported from ESM code

If you try to import this library from ESM code, you get a fatal error:

% npm i @filebase/client
npm WARN deprecated [email protected]: This module is deprecated, please upgrade to @multiformats/multiaddr-to-uri
npm WARN deprecated [email protected]: This module is deprecated, please upgrade to @multiformats/multiaddr

added 314 packages in 12s

29 packages are looking for funding
  run `npm fund` for details
% echo 'import { FilebaseClient } from "@filebase/client";' > foo.mjs
% node foo.mjs
node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_INVALID_PACKAGE_CONFIG]: Invalid package config /private/tmp/bar/node_modules/ipfs-car/dist/esm/package.json while importing /private/tmp/bar/node_modules/ipfs-car/dist/esm/pack/index.js. Unexpected token ''', "'{ "type" "... is not valid JSON
    at new NodeError (node:internal/errors:399:5)
    at getPackageConfig (node:internal/modules/esm/package_config:64:11)
    at getPackageScopeConfig (node:internal/modules/esm/package_config:112:27)
    at getPackageType (node:internal/modules/esm/resolve:690:25)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:54:12)
    at defaultGetFormatWithoutErrors (node:internal/modules/esm/get_format:103:43)
    at defaultResolve (node:internal/modules/esm/resolve:1094:13)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:837:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:418:18) {
  code: 'ERR_INVALID_PACKAGE_CONFIG'
}

Node.js v19.5.0

I ran into this because the js-ipfs packages all went ESM last year and I was trying upgrading a project that depended on this library to use ESM to make it easier to use the latest js-ipfs packages.

web usage?

@jtsmedley it seems impossible to pass web's Blob instance in to the storeBlob function. Any pointers?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.