Skip to content

Commit

Permalink
Merge pull request #5 from jreyesr/bugfix/4
Browse files Browse the repository at this point in the history
Closes #4
  • Loading branch information
jreyesr authored Feb 5, 2024
2 parents d6f5b36 + a63dda4 commit 96871e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
## v1.1.1 [2024-02-02]

- Fix issue #4: if the template binary file had been stored to disk by N8N (as opposed to keeping it in memory), the Render operation would fail with the error `ERROR: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Promise`. This was due to [a breaking change in N8N v1.9.0](https://github.com/n8n-io/n8n/blob/master/packages/cli/BREAKING-CHANGES.md#what-changed-3). Thanks to [@altvk88](https://github.com/altvk88) for reporting the issue and helping diagnose it!

## v1.1.0 [2023-08-25]

* Add the ability to set [render options](https://carbone.io/api-reference.html#options). Thanks, [@mrtnblv](https://github.com/mrtnblv)!
- Add the ability to set [render options](https://carbone.io/api-reference.html#options). Thanks, [@mrtnblv](https://github.com/mrtnblv)!

## v1.0.1 [2023-05-30]

* Add docs suggesting alternative for PDF rendering when running N8N on Docker (i.e. Gotenberg)
- Add docs suggesting alternative for PDF rendering when running N8N on Docker (i.e. Gotenberg)

## v1.0.0 [2023-50-27]

* Initial release
- Initial release
6 changes: 4 additions & 2 deletions nodes/CarboneNode/CarboneNode.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
INodeType,
INodeTypeDescription,
NodeOperationError,
BINARY_ENCODING,
} from 'n8n-workflow';
import type { Readable } from 'stream';
import { BINARY_ENCODING } from 'n8n-workflow';
import { convertDocumentToPdf, isWordDocument, renderDocument, buildOptions } from './CarboneUtils';

const nodeOperations: INodePropertyOptions[] = [
Expand Down Expand Up @@ -190,8 +190,10 @@ export class CarboneNode implements INodeType {
}
let fileContent: Buffer | Readable;
if (binaryData.id) {
fileContent = this.helpers.getBinaryStream(binaryData.id);
console.log(`Reading from file, id=${binaryData.id}`);
fileContent = await this.helpers.getBinaryStream(binaryData.id);
} else {
console.log(`Reading directly into buffer, size=${binaryData.data.length}`);
fileContent = Buffer.from(binaryData.data, BINARY_ENCODING);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "n8n-nodes-carbonejs",
"version": "1.1.0",
"version": "1.1.1",
"description": "A Carbone JS node that renders Word templates on n8n.io",
"keywords": [
"n8n-community-node-package"
Expand Down

0 comments on commit 96871e1

Please sign in to comment.