Skip to content

I can't add images to the face collection (TypeError: fs__WEBPACK_IMPORTED_MODULE_1___default.a.createReadStream is not a function) #20

@fabriciorsf

Description

@fabriciorsf

Describe the bug
I can't add faces images to the face collection.
I get the following error: TypeError: fs__WEBPACK_IMPORTED_MODULE_1___default.a.createReadStream is not a function.
I tested at versions:

  • compreface-javascript-sdk: 0.5.2 and 0.6.0
  • CompreFace Server: 0.6.0

To Reproduce

faceCollection.add(path_to_image, nameImgEncoded).then(response => {
  console.log(`Image ${path_to_image} added!`);
}).catch(error => {
  console.log(`Oops! There is problem in uploading image ${error}.`);
  console.log(error);
});

Expected behavior
A clear and concise description of what you expected to happen.

Logs

Oops! There is problem in uploading image TypeError: fs__WEBPACK_IMPORTED_MODULE_1___default.a.createReadStream is not a function.
TypeError: fs__WEBPACK_IMPORTED_MODULE_1___default.a.createReadStream is not a function
    upload_path common_endpoints.js:84
    add recognition_service.js:124
    add recognition_service.js:114

Additional context
I checked line 84 from common_endpoints.js (at function upload_path), and there is the following command:

bodyFormData.append('file', fs.createReadStream(image_path), { knownLength: fs.statSync(image_path).size });

Can you help me avoid this possible bug?
Tks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions