Execute fails with 'TypeError: Cannot read property 'buffer' of undefined [...]'
See original GitHub issueWhen 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
Any ideas why this is happening? Thanks for your help!
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
please reopen if https://www.npmjs.com/package/wasm-imagemagick/v/1.2.8 doesn’t work for you.
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 inoutputFiles
, and that is the result of the first command.