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] Dependency Resolution Issues with Bazel (Cannot find module 'ws' from) #1046

Open
jacob-petterle opened this issue Jan 6, 2025 · 2 comments
Labels
blocked bug Something isn't working

Comments

@jacob-petterle
Copy link

Describe the Bug

When using @mendable/firecrawl-js in a Bazel project, the package fails to resolve its dependencies properly. The isows dependency can't find the ws module even when both are installed and available in the build environment.

This seems related to #885 where similar issues occur in Firebase Functions, suggesting a broader problem with how dependencies are handled in non-Node environments.

To Reproduce

Here's a minimal reproduction using basic Bazel + TypeScript setup:

  1. Dependencies in package.json:
{
  "dependencies": {
    "@mendable/firecrawl-js": "1.11.2",
    "isows": "^1.0.1",
    "ws": "^8.18.0"
  }
}
  1. Bazel setup (any standard Node.js rules like rules_nodejs or better_rules_javascript):
# WORKSPACE
workspace(name = "my_workspace")

# Load your preferred Node.js Bazel rules and setup npm
  1. Basic BUILD target:
ts_library(
    name = "lib",
    srcs = ["index.ts"],
    deps = [
        "@npm//@mendable/firecrawl-js",
        "@npm//isows",
        "@npm//ws",
    ],
)
  1. Error Output:
Cannot find module 'ws' from '../../../npm_isows_1.0.6-0e085c71/files/_cjs/index.js'
Require stack:
- .../npm_isows_1.0.6-0e085c71/files/_cjs/index.js
- .../npm_mendable_firecrawl-js_1.11.2/files/dist/index.cjs

Expected Behavior

Package should work in Bazel builds just like it does in standard Node.js environments.

Environment

  • Firecrawl Version: 1.11.2
  • Node.js Version: 20.x
  • Build System: Bazel
  • OS: Linux (but reproducible on any OS)

Technical Details

The error comes from isows not being able to find ws through standard Node.js module resolution. This happens in Bazel because it enforces strict dependency declarations and module resolution.

Similar issue reported in #885 for Firebase Functions - both environments have strict dependency handling that differs from standard Node.js resolution.

Business Impact

We were planning to use Firecrawl (Standard Plan -> Growth Plan within 6 months) but this blocker is forcing us to evaluate alternatives since we need Bazel compatibility for our build system.

Additional Notes

  • Tried explicit dependency declarations at multiple levels
  • Tried various Bazel Node.js rule configurations
  • Issue persists regardless of specific Bazel Node.js rules used
@jacob-petterle jacob-petterle added the bug Something isn't working label Jan 6, 2025
@nickscamara
Copy link
Member

Hey @jacob-petterle, @mogery is looking into it! Thanks for reporting the issue!

@mogery
Copy link
Member

mogery commented Jan 7, 2025

Hi Jacob, I can not set up Bazel for the life of me. Can you please provide an example config/directory tree/minimum recreation repo?

@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

3 participants