Node code error in UI, but unable to see the error

If I enter the following code in a node step… and test it, I get an error notification, but I cannot see the error anywhere to know what it is ?

import pdf from 'pdf-parse';
export default defineComponent({
	async run({ steps, $ }) {
		// Return data to use it in future steps
	  return 'test'
	},
});

I know it’s the import line, as if I remove that it works… just not sure what is failing… which leads to the second question… I have tried both the require and import methods for PDF-parse, neither seem to work, any advice ?

Hi @mikeb

First off, welcome to the Pipedream community. Happy to have you!

It’s possible that pdf-parse includes a binary that’s not compatible with an ARM architecture.

I recommend trying other Node or Python libraries, and make sure they support running in an AWS Lambda runtime.

Alternatively, you can use an API that provides this functionality as a service for the most ease of use.

Hi @pierce

I thought it might have been something todo with binaries, as I saw issues in other posts about puppeteer… but I checked and it’s dependency’s are node-ensure and debug which are not binary.

Is there anyway to get to see the error that happens when I try and test that code ?

I looked at the other PDF options in PD, as well as other services, but they don’t parse the source PDF I am working with correctly (lots of tables and pages).

I can try and see if pdf-parse works in an arm Lambda, and circle back if it does.

Sure thing @mikeb , I hope you can find an Node package or alternative.

Another commercial option is Adobe’s PDF API: Adobe PDF Services | PDF Tools APIs | Adobe Document Services - Adobe Developers

At that point you’d just need to use the built in HTTP Request action to interact with with it.

@pierce

I tried the code in a aws lambda with arm and it worked fine.

So I guess back to trying to figure out what in PD it does not like with this import/require ?

Hi @mikeb

This prior Github issue reported for a different library is the same error, I think they are related:

Could you please comment on it to help us triage it?