Skip to content

Stripe Node SDK: all resource methods undefined (stripe.products.create etc. is not a function) #4831

Description

@proggeramlug

Summary

The official Stripe Node SDK (stripe v17) is non-functional when compiled with Perry: the resource namespaces exist (stripe.products, stripe.customers, stripe.checkout, …) but every resource method is undefined (stripe.products.create, stripe.customers.create, stripe.subscriptions.create, stripe.checkout.sessions.create, …). Calling any of them throws TypeError: create is not a function.

The Stripe SDK builds its resource methods dynamically — StripeResource.extend({ create: stripeMethod({ method: 'POST', ... }) }) assigns method functions onto resource prototypes via a factory. Perry appears not to materialize those prototype method assignments, so the methods are missing at runtime.

This blocks all Stripe operations (products, prices, subscriptions, payment intents, checkout sessions, customers) — i.e. an entire payments integration.

Repro (verified on Linux)

import Stripe from "stripe";
const s: any = new Stripe("sk_test_dummy", {});
console.log("typeof stripe:", typeof s);
console.log("typeof stripe.products:", typeof s.products);
console.log("typeof stripe.products?.create:", typeof s.products?.create);
console.log("typeof stripe.customers?.create:", typeof s.customers?.create);
console.log("typeof stripe.subscriptions?.create:", typeof s.subscriptions?.create);
console.log("typeof stripe.prices?.create:", typeof s.prices?.create);
console.log("typeof stripe.checkout?.sessions?.create:", typeof s.checkout?.sessions?.create);
console.log("typeof stripe.paymentIntents?.create:", typeof s.paymentIntents?.create);
npm i stripe   # v17
perry compile stripebug.ts -o stripebug && ./stripebug

Actual (bug)

typeof stripe: object
typeof stripe.products: object
typeof stripe.products?.create: undefined
typeof stripe.customers?.create: undefined
typeof stripe.subscriptions?.create: undefined
typeof stripe.prices?.create: undefined
typeof stripe.checkout: object
typeof stripe.checkout?.sessions?.create: undefined
typeof stripe.paymentIntents?.create: undefined

Expected

All resource methods are function:

typeof stripe.products?.create: function
typeof stripe.customers?.create: function
...

Likely area

Dynamic prototype method assignment used by StripeResource / stripeMethod (the factory that attaches create/retrieve/list/update/del to each resource). Whatever construction step adds those methods to the resource object/prototype isn't taking effect under Perry. Reproducing how the Stripe SDK extends resources (StripeResource.extend({...}) + per-method stripeMethod(spec)) in isolation should localize it.

Environment

  • Linux x86_64 (Ubuntu 24.04)
  • perry main @ b593fb735
  • stripe ^17.x (Node SDK)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions