lsongdev / lsongdev/node-escpos

[BUG]: Image Example returns a Unhandled Rejection: TypeError: Only escpos.Image supported at: [object Promise]

Open
#442 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.6k
Forks
443
PR merge metrics
No merged PRs in 30d

Description

### Description of the bug

I'm trying to print this example

printer.align('ct')
.image(image, 's8')
.then(() => {
printer.cut()
.close();
});

my implementation

const imagePath = path.join(__dirname, '/assets/apple-icon.png');

escpos.Image.load(imagePath, function (image) {
device.open(function () {
printer
.align('ct')
.image(image, 's8')
.then(() => {
printer.cut().close();
});
});
});

i get

❌ error:
Unhandled Rejection: TypeError: Only escpos.Image supported at: [object Promise]

### Steps To Reproduce

empty

### Additional Information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at escpos.Image.load and the printer.image call shown in the report, then reproduce the example with the provided apple-icon.png path. Trace why the image call receives a Promise instead of an escpos.Image; done means the example prints without the unhandled rejection and the existing cut-and-close flow still runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.