Skip to content

Conversation

@MananTank
Copy link
Member

@MananTank MananTank commented Oct 20, 2025


PR-Codex overview

This PR addresses an issue where a process not defined error occurred when using the thirdweb/contract import in Vite. It modifies the way the PUBLISHED_PRIVATE_KEY is exported to ensure compatibility.

Detailed summary

  • Updated PUBLISHED_PRIVATE_KEY export to check if process is defined before accessing process.env.ZKSYNC_PUBLISHED_PRIVATE_KEY.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • Chores

    • Improved environment configuration handling to be more robust in non-Node environments, reducing unexpected runtime errors when the library is imported in diverse build setups.
  • Bug Fixes

    • Resolved a "process not defined" error that could occur during import in certain bundlers (e.g., Vite); included as a patch release to improve compatibility and stability.

@vercel
Copy link

vercel bot commented Oct 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Oct 20, 2025 2:05pm
nebula Ready Ready Preview Comment Oct 20, 2025 2:05pm
thirdweb_playground Ready Ready Preview Comment Oct 20, 2025 2:05pm
thirdweb-www Ready Ready Preview Comment Oct 20, 2025 2:05pm
wallet-ui Ready Ready Preview Comment Oct 20, 2025 2:05pm

💡 Enable Vercel Agent with $100 free credit for automated AI reviews

@changeset-bot
Copy link

changeset-bot bot commented Oct 20, 2025

🦋 Changeset detected

Latest commit: ceba683

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

This PR includes changesets to release 4 packages
Name Type
thirdweb Patch
@thirdweb-dev/nebula Patch
@thirdweb-dev/wagmi-adapter Patch
wagmi-inapp 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

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Oct 20, 2025
@MananTank MananTank marked this pull request as ready for review October 20, 2025 12:32
@MananTank MananTank requested review from a team as code owners October 20, 2025 12:32
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 20, 2025

Walkthrough

The PUBLISHED_PRIVATE_KEY constant initializer was hardened to safely detect and read process.env by adding explicit checks (typeof process !== "undefined", process, and process.env) instead of a simple truthiness check; a changeset file was also added for a patch release documenting the fix.

Changes

Cohort / File(s) Change Summary
Environment variable access hardening
packages/thirdweb/src/utils/any-evm/zksync/constants.ts
Strengthened PUBLISHED_PRIVATE_KEY initializer to use typeof process !== "undefined" && process && process.env ? process.env.ZKSYNC_PUBLISHED_PRIVATE_KEY : undefined, preventing runtime "process not defined" errors in non-Node environments.
Release metadata
.changeset/small-taxes-heal.md
Added changeset documenting a patch release that fixes the "process not defined" error when importing thirdweb/contract in Vite.

Sequence Diagram(s)

(omitted — changes are a small constant initializer and a metadata file; no control-flow changes warranting a sequence diagram)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description does not follow the repository's template structure. While a PR-Codex auto-generated overview is included that provides context about the fix, the required template sections remain unfilled—specifically, the "Notes for the reviewer" and "How to test" sections are left as template comments with no actual content. Additionally, no Linear issue tag (TEAM-0000 format) is provided despite the template requesting it. The PR-Codex overview alone, while helpful, does not substitute for the structured information requested in the template. Complete the PR description by filling out the required template sections. Provide the Linear issue tag (TEAM-0000), add relevant notes for reviewers that call out any important considerations or implications of the fix, and clearly document how to test the changes (e.g., which unit tests, playground scenarios, or manual verification steps should be performed to validate the fix works in Vite).
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "SDK: Fix process not defined error in Vite" clearly and concisely summarizes the main change in the changeset. It identifies the component (SDK), the type of change (Fix), and the specific issue being resolved (process not defined error in Vite), which directly aligns with the core modification to PUBLISHED_PRIVATE_KEY to guard against undefined process objects. The title is specific enough that teammates scanning history would understand the primary purpose of the change without ambiguity.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 10-20-sdk_fix_process_not_defined_error

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 22e4db7 and ceba683.

📒 Files selected for processing (2)
  • .changeset/small-taxes-heal.md (1 hunks)
  • packages/thirdweb/src/utils/any-evm/zksync/constants.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/small-taxes-heal.md
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/utils/any-evm/zksync/constants.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/utils/any-evm/zksync/constants.ts
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/utils/any-evm/zksync/constants.ts
🪛 GitHub Check: codecov/patch
packages/thirdweb/src/utils/any-evm/zksync/constants.ts

[warning] 9-9: packages/thirdweb/src/utils/any-evm/zksync/constants.ts#L9
Added line #L9 was not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b33c1a3 and 0232b45.

📒 Files selected for processing (1)
  • packages/thirdweb/src/utils/any-evm/zksync/constants.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/utils/any-evm/zksync/constants.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/utils/any-evm/zksync/constants.ts
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/utils/any-evm/zksync/constants.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)

@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.89%. Comparing base (b33c1a3) to head (ceba683).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ges/thirdweb/src/utils/any-evm/zksync/constants.ts 50.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8280   +/-   ##
=======================================
  Coverage   54.89%   54.89%           
=======================================
  Files         919      919           
  Lines       60622    60623    +1     
  Branches     4115     4116    +1     
=======================================
+ Hits        33277    33282    +5     
+ Misses      27244    27240    -4     
  Partials      101      101           
Flag Coverage Δ
packages 54.89% <50.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
...ges/thirdweb/src/utils/any-evm/zksync/constants.ts 95.23% <50.00%> (+0.11%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.51 KB (0%) 1.3 s (0%) 143 ms (+133.42% 🔺) 1.5 s
thirdweb (cjs) 365.68 KB (0%) 7.4 s (0%) 564 ms (+4.5% 🔺) 7.9 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 69 ms (+3228.48% 🔺) 184 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 93 ms (+6932.83% 🔺) 104 ms
thirdweb/react (minimal + tree-shaking) 19.13 KB (0%) 383 ms (0%) 65 ms (+2352.8% 🔺) 447 ms

@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 20, 2025

Merge activity

<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview

This PR addresses a `process not defined` error that occurs when using the `thirdweb/contract` import in Vite by ensuring that the `process` variable is only accessed when it is defined.

### Detailed summary

- Updated `PUBLISHED_PRIVATE_KEY` export in `packages/thirdweb/src/utils/any-evm/zksync/constants.ts` to check if `process` is defined before accessing `process.env.ZKSYNC_PUBLISHED_PRIVATE_KEY`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Chores**
  - Improved robustness of environment configuration handling to avoid runtime issues in non-Node environments.

- **Bug Fixes**
  - Fixed a "process not defined" error that could occur when importing the library in Vite, included in a patch release.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants