Skip to content

[P0/Blocker] Both teamsapp and atk CLIs crash on Node.js v25 — SlowBuffer removed (two crash sites) #15437

@VikrantSingh01

Description

@VikrantSingh01

Severity: Blocker

Both @microsoft/m365agentstoolkit-cli@1.1.4 (atk) and @microsoft/teamsapp-cli@3.0.10 (teamsapp) are completely unusable on Node.js v25 — every command crashes before execution. Node 25 is the current release line. This blocks all CLI-based workflows (CI/CD, provisioning, deployment) for developers on Node 25.

Root Cause

SlowBuffer was removed from Node.js v25 (nodejs/node#56601). require('buffer').SlowBuffer returns undefined.

Two bundled dependencies access SlowBuffer.prototype at module load time without guards, causing immediate crashes:

Crash Site 1: buffer-equal-constant-time (webpack module 33789) — crashes first

var Buffer = __webpack_require__(20181).Buffer,
    SlowBuffer = __webpack_require__(20181).SlowBuffer;  // ← undefined in Node 25

// Line that crashes:
var origSlowBufEqual = SlowBuffer.prototype.equal;
// TypeError: Cannot read properties of undefined (reading 'prototype')

Dependency chain: jsonwebtokenjwsjwabuffer-equal-constant-time

Crash Site 2: iconv-lite (webpack module 81542) — hidden, would crash second

var SlowBuffer = __webpack_require__(20181).SlowBuffer;  // ← undefined in Node 25

// Line that would crash (currently masked by crash site 1):
original.SlowBufferToString = SlowBuffer.prototype.toString;
// TypeError: Cannot read properties of undefined (reading 'prototype')

25 total SlowBuffer references exist in the bundle across these two packages plus safer-buffer (which is safe — it only checks the string name, not .prototype).

Steps to Reproduce

node -v   # v25.6.1
npx atk --version            # crashes
npx teamsapp --version       # crashes
npx teamsapp provision       # crashes

Error Output

TypeError: Cannot read properties of undefined (reading 'prototype')
    at 33789 (.../node_modules/@microsoft/m365agentstoolkit-cli/lib/index.js:2:496047)
    at __webpack_require__ (.../lib/index.js:20:3126116)
    at 26161 (.../lib/index.js:2:931210)
    at __webpack_require__ (.../lib/index.js:20:3126116)
    at 6842  (.../lib/index.js:2:937880)
    at __webpack_require__ (.../lib/index.js:20:3126116)
    at 15238 (.../lib/index.js:2:936303)
    at __webpack_require__ (.../lib/index.js:20:3126116)
    at 27664 (.../lib/index.js:2:913084)
    at __webpack_require__ (.../lib/index.js:20:3126116)

Verification

# Confirm SlowBuffer is gone in Node 25:
node -e "console.log(typeof require('buffer').SlowBuffer)"
# Output: undefined

Suggested Fixes

Both affected packages need updates, then the webpack bundle needs to be rebuilt:

Package Fix
buffer-equal-constant-time Replace with crypto.timingSafeEqual (built-in since Node 6)
iconv-lite Update to v0.6+ which guards SlowBuffer access, or use Node built-in TextDecoder/TextEncoder

Quick interim fix — add a shim at the webpack bundle entry point:

const buffer = require('buffer');
if (!buffer.SlowBuffer) {
  buffer.SlowBuffer = buffer.Buffer; // minimal polyfill
}

Environment

Item Value
Node.js v25.6.1
OS macOS Darwin 25.3.0 arm64
@microsoft/m365agentstoolkit-cli 1.1.4
@microsoft/teamsapp-cli 3.0.10

Workaround

  • Use Node.js 20 LTS (e.g. nvm use 20) for CLI commands
  • The Teams Toolkit VS Code extension is unaffected — it uses its own bundled Node runtime

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions