App code snapshot error: Snapshot error occurred: Error: Automatic publicPath is not supported in this browser

I added a js package to my forge app pdfjs-parse
and now when I try to deploy I get

Error: Error thrown in the snapshot context.
App code snapshot error: Snapshot error occurred: Error: Automatic publicPath is not supported in this browser
Learn more about the snapshot context at https://go.atlassian.com/forge-snapshot-context.

Very frustrating as many packages I try seem to throw different errors

e.g.

import PDFParser from "pdf2json";
// Error: Bundling failed: export 'fileURLToPath' (imported as 'fileURLToPath') was not found in 'url' (possible exports: Url, format, parse, resolve, resolveObject), Module not found: Error: Can't resolve 'fs/promises' in '/node_modules/pdf2json', export 'fileURLToPath' (imported as 'fileURLToPath') was not found in 'url' (possible exports: Url, format, parse, resolve, resolveObject)
import pdfText from 'pdf-text';
// Error: Cannot find module 'underscore'
import {PDFExtract} from 'pdf.js-extract';
// Error: Bundling failed: Module not found: Error: Can't resolve 'canvas' in 'node_modules/pdf.js-extract/lib/pdfjs'

I’ve since moved past deploy issues by using an older version of pdf.js however now I’m getting the following error when my function gets invoked.

ERROR   19:08:30.144  a7b07fba8e525faf  Setting up fake worker failed: "require is not defined".
Error: Setting up fake worker failed: "require is not defined".
    at /tmp/tunnel9dX28ktw1uI2j/jira.js:17705:43

Any insight would be much appreciated…