Skip to content

chore: bump baileys to 7.0.0-rc10 + tsx 4.21 with whatsapp-rust-bridge patch#2531

Closed
DavidsonGomes wants to merge 1 commit intodevelopfrom
fix/whatsapp-rust-bridge-exports
Closed

chore: bump baileys to 7.0.0-rc10 + tsx 4.21 with whatsapp-rust-bridge patch#2531
DavidsonGomes wants to merge 1 commit intodevelopfrom
fix/whatsapp-rust-bridge-exports

Conversation

@DavidsonGomes
Copy link
Copy Markdown
Member

@DavidsonGomes DavidsonGomes commented May 6, 2026

Summary

  • Bumps baileys from 7.0.0-rc.9 to 7.0.0-rc10 and tsx from ^4.20.5 to ^4.21.0.
  • Adds a pnpm patch for whatsapp-rust-bridge@0.5.3 that adds main, require, and default to the exports field so the package can be resolved from CJS projects (this repo has no "type": "module").
  • Migrates lockfile management to pnpm (deletes package-lock.json, adds pnpm-workspace.yaml so the patch is picked up).

Why

Running npm run dev:server on develop was failing with:

ERR_PACKAGE_PATH_NOT_EXPORTED: No "exports" main defined in node_modules/whatsapp-rust-bridge/package.json

The bridge (a transitive dependency pulled in by baileys rc10) only declares exports.import + exports.types, with no require/default. Because evolution-api is a CJS project, both Node and tsx resolve through the CJS loader and fail.

The patch adds the missing fields without changing runtime behavior — the same dist/index.js is served for every condition.

Test plan

  • pnpm install applies the patch cleanly
  • pnpm run dev:server boots the API on port 8080 and connects to WhatsApp
  • CI green
  • Verify other devs can install with pnpm and run dev:server

Notes for reviewers

  • Lockfile switched from npm to pnpm. If the team prefers staying on npm, this PR would need to revert the lockfile change and find another resolution mechanism (npm doesn't have a built-in patch system).
  • Upstream fix should be requested at https://github.com/jlucaso1/whatsapp-rust-bridge — the exports field is missing default.

Summary by Sourcery

Update WhatsApp integration dependencies and adopt pnpm-based patching for a transitive bridge package.

Bug Fixes:

  • Ensure whatsapp-rust-bridge can be resolved correctly in CommonJS projects by applying a pnpm patch to its exports configuration.

Enhancements:

  • Upgrade baileys to 7.0.0-rc10 and tsx to ^4.21.0.

Build:

  • Switch lockfile management to pnpm by adding a pnpm workspace configuration and removing the npm package-lock file.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 6, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates Baileys and tsx versions and switches lockfile management to pnpm, adding a pnpm patch for whatsapp-rust-bridge so it can be resolved correctly in this CJS-based project.

Sequence diagram for dev server startup with patched whatsapp_rust_bridge resolution

sequenceDiagram
    actor Dev
    participant NpmScript as npm_run_dev_server
    participant Tsx as tsx_loader
    participant Node as node_cjs_loader
    participant Pnpm as pnpm_with_patch
    participant Baileys as baileys_7_0_0_rc10
    participant Bridge as whatsapp_rust_bridge_0_5_3

    Dev->>NpmScript: run dev:server
    NpmScript->>Tsx: start tsx with entrypoint
    Tsx->>Node: resolve baileys
    Node->>Pnpm: locate baileys_7_0_0_rc10
    Pnpm-->>Node: baileys package.json
    Node->>Baileys: load baileys
    Baileys->>Node: requires whatsapp_rust_bridge
    Node->>Pnpm: resolve whatsapp_rust_bridge_0_5_3
    Pnpm-->>Bridge: apply pnpm patch (add exports main require default)
    Pnpm-->>Node: patched package.json
    Node->>Bridge: load CJS entry via exports.require/default
    Bridge-->>Baileys: initialized bridge bindings
    Baileys-->>Tsx: baileys initialized
    Tsx-->>Dev: dev server running and connected to WhatsApp
Loading

File-Level Changes

Change Details Files
Upgrade core runtime dependencies (Baileys and tsx) to newer release candidates.
  • Bump baileys from 7.0.0-rc.9 to 7.0.0-rc10 in dependencies.
  • Bump tsx from ^4.20.5 to ^4.21.0 in devDependencies.
  • Tidy dependency ordering around fetch-socks without changing versions.
package.json
Adopt pnpm for lockfile and dependency patch management.
  • Add pnpm-workspace.yaml configured with patchedDependencies entry for whatsapp-rust-bridge@0.5.3.
  • Remove npm-based package-lock.json from version control.
pnpm-workspace.yaml
package-lock.json
Introduce a pnpm patch to fix whatsapp-rust-bridge CJS resolution issues.
  • Add a pnpm patch file for whatsapp-rust-bridge@0.5.3 so that pnpm applies it on install.
  • Patch adds main, require, and default to the exports field of whatsapp-rust-bridge so it can be loaded from CJS/tsx without changing runtime behavior.
patches/whatsapp-rust-bridge@0.5.3.patch

Possibly linked issues

  • #: PR upgrades Baileys to v7 (rc10), directly addressing the request to update to Baileys v7.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@DavidsonGomes
Copy link
Copy Markdown
Member Author

Reabrindo com nome de branch correto refletindo o bump do baileys.

@DavidsonGomes DavidsonGomes deleted the fix/whatsapp-rust-bridge-exports branch May 6, 2026 20:36
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Now that the patch is handled via pnpm’s patchedDependencies, consider removing the patch-package devDependency if it’s no longer used anywhere else in the repo to avoid confusion.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Now that the patch is handled via pnpm’s `patchedDependencies`, consider removing the `patch-package` devDependency if it’s no longer used anywhere else in the repo to avoid confusion.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant