question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Execute fails with 'TypeError: Cannot read property 'buffer' of undefined [...]'

See original GitHub issue

When executing two simple image manipulation commands in a browser environment, the ExecuteResult object will contain an error and only the result of the first command is provided.

Code:

import { buildInputFile, execute } from 'https://cdn.jsdelivr.net/npm/wasm-imagemagick/dist/bundles/magickApi.js';

let DoMagickCall = async function () {
  let result = await execute({
    inputFiles: [await buildInputFile('./locked-out.png', 'frame.png')],
    commands: [
      'convert frame.png -rotate 90 image2.png',
      'convert image2.png -rotate 45 image3.png'
    ]
  });

  console.log(result);
}

DoMagickCall();

Result:

result:
  errors: Array(2)
    0: undefined
    1: "TypeError: Cannot read property 'buffer' of undefined, exit code: 1, stderr: "
  exitCode: 1
  outputFiles: Array(1)
    0: {name: "image2.png", buffer: Uint8Array(67478)}
  results: Array(2)
    0: {outputFiles: Array(1), stdout: Array(0), stderr: Array(0), exitCode: 0, errors: Array(1)}
    1: {stderr: Array(0), stdout: Array(0), outputFiles: Array(0), exitCode: 1, errors: Array(1)}

Download test files to reproduce

WASM-ImageMagick_issue_51.zip

Any ideas why this is happening? Thanks for your help!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
KnicKniccommented, Aug 20, 2020

please reopen if https://www.npmjs.com/package/wasm-imagemagick/v/1.2.8 doesn’t work for you.

1reaction
Sidewinder53commented, Jul 14, 2019

Unfortunately, I don’t get the same result. Please note that the image appearing in the DOM does not mean that the operation succeeded. You have to open the developer tools and check the first object in the console which will output these errors:

Google Chrome 75.0.3770.100

Microsoft Edge 44.18362.1.0

Firefox 69.0b4

Microsoft Edge (Chromium) 77.0.211.3

The result object will always contain only one output in outputFiles, and that is the result of the first command.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Cannot read property 'buffer' of undefined cloudinary
If i change it to req.file I end up have this error UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'buffer' of undefined. – ...
Read more >
TypeError: Cannot read property 'Buffer' of undefined · Issue #54
When transit-js gets imported into jest I get the following error: TypeError: Cannot read property 'Buffer' of undefined 1 | import React ...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
cannot read properties of undefined (reading 'buffer') - You.com
Here's an example of a JavaScript TypeError: Cannot read property of undefined thrown when a property is attempted to be read on an...
Read more >
TypeError: Cannot read property 'startsWith' of undefined
Then the error appears when i try to run node index.js inside src folder. if I replace the process.env.MOGNGO_CONNECTION_STRING variable by this ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found