firecrawl icon indicating copy to clipboard operation
firecrawl copied to clipboard

[Bug] @mendable/firecrawl-js incompatible with firebase functions

Open goodspeed3 opened this issue 3 months ago • 1 comments

Describe the Bug Cannot deploy to firebase functions using this SDK.

To Reproduce Steps to reproduce the issue:

  1. initiate Firebase function
  2. import @mendable/firecrawl-js and use any firebase function
  3. Deploy firebase function
  4. See error message
i  functions: updating Node.js 20 (1st Gen) function triggers-onUserCreated(us-central1)...
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Provided module can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'ws'
Require stack:
- /layers/google.nodejs.yarn/yarn_modules/nfeat: dynamically import WebSocket module with error handlingode_modules/isows/_cjs/index.js
- /layers/google.nodejs.yarn/yarn_modules/node_modules/@mendable/firecrawl-js/dist/index.cjs
- /workspace/main.js
- /layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/loader.js
- /layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/main.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Module._load (node:internal/modules/cjs/loader:1051:27)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/layers/google.nodejs.yarn/yarn_modules/node_modules/isows/_cjs/index.js:4:20)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
Could not load the function, shutting down.. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.

Expected Behavior Successful deployment

Environment (please complete the following information):

  • Firecrawl Version: 1.2.7
  • Node.js Version: 20

Additional Context Once I remove the @mendable library from firebase functions, deploy is successful.

Works fine with Firebase emulators.

goodspeed3 avatar Nov 11 '24 05:11 goodspeed3