Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
goodspeed3 opened this issue Nov 11, 2024 · 1 comment
Open
Assignees
Labels
blocked bug Something isn't working

Comments

@goodspeed3
Copy link

goodspeed3 commented Nov 11, 2024

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.

@mogery
Copy link
Member

mogery commented Jan 7, 2025

Hi there! This works fine with the following function:

const functions = require('@google-cloud/functions-framework');
const FirecrawlApp = require("@mendable/firecrawl-js").default;

// Register an HTTP function with the Functions Framework that will be executed
// when you make an HTTP request to the deployed function's endpoint.
functions.http('test-fc-fn', async (req, res) => {
  const app = new FirecrawlApp({ apiKey: "<API KEY>" })
  res.json(await app.scrapeUrl("https://firecrawl.dev"))
});

Could you share some more details on your setup please?

@linear linear bot added the blocked label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants