Skip to content

fix(connectors): throw on empty or whitespace WalletConnect projectId#5031

Closed
Zelys-DFKH wants to merge 1 commit intowevm:mainfrom
Zelys-DFKH:fix/walletconnect-projectid-validation
Closed

fix(connectors): throw on empty or whitespace WalletConnect projectId#5031
Zelys-DFKH wants to merge 1 commit intowevm:mainfrom
Zelys-DFKH:fix/walletconnect-projectid-validation

Conversation

@Zelys-DFKH
Copy link
Copy Markdown

@Zelys-DFKH Zelys-DFKH commented Mar 24, 2026

Closes #5030

The WalletConnect connector accepted an empty string or whitespace-only projectId without complaint. When that happened, the QR modal never appeared and connections failed silently. No error, no log, nothing. This comes up when VITE_WC_PROJECT_ID (or the React/Next equivalent) is missing, or when a .env file has a trailing newline that corrupts the value.

The fix trims and checks projectId at connector creation and throws a BaseError immediately if it's falsy. Fail at config time, not at user-click time.

Changes

  • packages/connectors/src/walletConnect.ts — validate projectId at the top of walletConnect(), before any lazy provider initialization runs
  • packages/connectors/src/walletConnect.test.ts — two tests covering empty string and whitespace-only

Closes wevm#5030

Co-Authored-By: Zelys-DFKH <noreply@github.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 24, 2026

🦋 Changeset detected

Latest commit: 9855118

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@wagmi/connectors Patch
wagmi Patch
@wagmi/solid Patch
@wagmi/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 24, 2026

@Zelys-DFKH is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@tmm
Copy link
Copy Markdown
Member

tmm commented Apr 6, 2026

Thanks for the PR! Better if this is handled at the WalletConnect SDK-level

@tmm tmm closed this Apr 6, 2026
@Zelys-DFKH
Copy link
Copy Markdown
Author

Thanks for the feedback. Understood. This belongs at the SDK level. Closing in favor of that approach.

@Zelys-DFKH
Copy link
Copy Markdown
Author

Following your feedback, I've submitted the projectId validation fix upstream to WalletConnect/walletconnect-monorepo#7216 as you suggested. This ensures the fix benefits all SDKs that depend on EthereumProvider, not just wagmi.

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.

WalletConnect connector silently fails when projectId is empty or whitespace

2 participants