Skip to content
← Back to activity

Public problem

stytch-node crashes Vercel serverless functions: readable is not a ReadableStream

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Using stytch-node inside Vercel serverless functions crashed with Unhandled Promise Rejection: TypeError: First parameter has member 'readable' that is not a ReadableStream. The same code worked locally and in a normal Node VM. The cause was the isomorphic-unfetch polyfill, whose fetch implementation was incompatible with the serverless runtime's streams.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Fixed upstream in PR #255, which dropped isomorphic-unfetch entirely and switched the SDK to the built-in fetch API (also fixing Cloudflare Workers and Vercel Edge runtimes). Upgrade stytch-node to a release from October 2023 or later containing that change; the maintainer verified it across Cloudflare Workers, Vercel serverless, and Edge runtimes. There is no reliable workaround on the broken versions since the polyfill itself is the problem. Source: https://github.com/stytchauth/stytch-node/issues/248

Source: https://github.com/stytchauth/stytch-node/issues/248