Describe the issue/error/question
I have a custom node that I’ve created with n8n-node-dev, the node compiles just fine but when I start n8n I get an error message.
What is the error message (if any)?
Error loading node "PDF" from: "/home/user/.n8n/custom/PDF.node.js" - tempModule[nodeName] is not a constructor
› Error: There was an error: tempModule[nodeName] is not a constructor
Please share the workflow
No workflow but here’s the node definition.
import { IExecuteFunctions } from 'n8n-core';
import { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
export class MPdf implements INodeType {
description: INodeTypeDescription = {
displayName: 'PDF Fill',
name: 'pdf',
group: ['transform'],
version: 1,
description: 'Fills input PDF based on the JSON payload.',
defaults: {
name: 'PDF Fill',
color: '#772244',
},
inputs: ['main', 'main'],
outputs: ['main'],
properties: [
{
displayName: 'My String',
name: 'myString',
type: 'string',
default: '',
placeholder: 'Placeholder value',
description: 'The description text',
},
],
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData(0);
const pdf = this.getInputData(1);
console.log(items, pdf)
let item: INodeExecutionData;
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
item = items[itemIndex];
const payload = JSON.parse(item.json['fields'] as string);
Object.entries(payload).forEach(
([key, value]) => console.log(key, value)
);
item = items[itemIndex];
}
return this.prepareOutputData(items);
}
}
Share the output returned by the last node
Information on your n8n setup
- n8n version: 0.189.1
- Database you’re using (default: SQLite): SQLite
- Running n8n with the execution process [own(default), main]: default
- Running n8n via [Docker, npm, n8n.cloud, desktop app]: npm