Repeated compile errors on uploading external depency

I’m trying to upload some libraries needed to do scraping in a function triggered by an insert.

When I try to upload just puppeteer, the page crashes, so I tried to switch to jsdom but I keep getting

“Failed to upload node_modules.tar.gz: unknown: Unexpected token, expected”

Errors, I tracked down the first one to /Users/felip/Downloads/node_modules/jsdom/lib/jsdom/living/helpers/dates-and-times.js

There was a try-catch on line 235 that did not have “(error)” after “catch”

But now I’m getting “Failed to upload node_modules.tar.gz: unknown: Unexpected token, expected ( (49:10) 47 | 48 | return true; > 49 | } catch { | ^ 50 | return false; 51 | } 52 | }”

I tried using an older version of jsdom and ran into similar issues. Is there a better way to get this working or should I just have my function make a call to GCP pubsub and handle my scraping call in a Google Cloud Function instead of Realm?