Skip to content

Wrangler 4.16 breaks compatibility with some libraries because of eval check #9352

@zhelezkov

Description

@zhelezkov

What versions & operating system are you using?

wrangler 4.16

Please provide a link to a minimal reproduction

https://github.com/zhelezkov/cf-workers-eval-issue

Describe the Bug

After upgrading from Wrangler 4.15 to 4.16, Cloudflare Workers fail to deploy or run when dependencies contain eval statements. This affects several popular libraries, including js-sha256@0.9.0, which has more than 1M downloads.

Probably related to cloudflare/workerd#4142

Reproduction Steps

  1. Install dependencies with npm install
  2. Try to deploy or run locally with npm run dev or npm run deploy
  3. Observe the failure when using Wrangler 4.16
  4. Downgrade to Wrangler 4.15 to confirm the issue is resolved

Workaround

Downgrade to Wrangler 4.15:

npm install wrangler@4.15.0 --save-dev

Expected Behavior

Workers should deploy and run successfully with libraries containing eval, as they did in Wrangler 4.15 and earlier versions.

Environment

  • Node.js version: v22.16.0
  • Wrangler version: 4.16.1 (broken), 4.15.0 (working)
  • Operating system: macOS Sequoia 15.5

Please provide any relevant error logs

✘ [ERROR] service core:user:cf-workers-eval-issue: Uncaught Error: EvalError: Code generation from strings disallowed for this context

    at null.<anonymous> (index.js:1260:22) in nodeWrap
    at null.<anonymous> (index.js:1245:21) in createMethod
    at null.<anonymous> (index.js:1626:21)
    at null.<anonymous> (index.js:1642:7) in node_modules/js-sha256/src/sha256.js
    at null.<anonymous> (index.js:12:50) in __require
    at null.<anonymous> (index.js:1666:32)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't workingregressionBreak in existing functionality as a result of a recent change

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions