Rayy
Rayyā€¢12mo ago

Error while trying to import third party libraries.

I have no idea why am I getting this error
āœ– Error: Unable to push deployment config to https://content-tortoise-560.convex.cloud
400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Uncaught Failed to analyze openai.js: ENOENT: no such file or directory, open './test/data/05-versions-space.pdf'
āœ– Error: Unable to push deployment config to https://content-tortoise-560.convex.cloud
400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Uncaught Failed to analyze openai.js: ENOENT: no such file or directory, open './test/data/05-versions-space.pdf'
when trying to import the below libraries
"use node"

const fs = require("fs");
const pdf = require("pdf-parse");
"use node"

const fs = require("fs");
const pdf = require("pdf-parse");
I am already using the "use node" declarative as mentioned in the docs.
3 Replies
erquhart
erquhartā€¢12mo ago
This is an issue with pdf-parse running on any serverless runtime - some potential solutions in here: https://gitlab.com/autokent/pdf-parse/-/issues/24
GitLab
ENOENT: no such file or directory, open './test/data/05-versions-sp...
i am using the module in my aws lambda function which is in node js. const pdf = require('pdf-parse'); this is how i am importing it but getting...
Rayy
RayyOPā€¢12mo ago
I went through the entire thread, and I feel like the best solution is to vendor the code from the library, but I am facing difficulties in the dynamic import line. Can you help me figure that out? PDFJS = PDFJS ? PDFJS : require(./pdf.js/${options.version}/build/pdf.js); What changes do I need to implement here? Can't get any of the solution to work, each one leads to another error. šŸ˜¦

Did you find this page helpful?