[GH-ISSUE #3138] [@better-auth/stripe] updatedAt field missing from schema in plugin #18119

Closed
opened 2026-04-15 16:30:12 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @joaoseidel on GitHub (Jun 23, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/3138

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

A webhook call triggers the following error:

2025-06-23T06:00:57.826Z ERROR [Better Auth]: Stripe webhook failed. Error: Could not find property pointer for update shape key: 'updatedAt'

This happens in better-auth/packages/stripe/src/index.ts at:

await ctx.context.adapter.update({
  model: "subscription",
  update: {
    cancelAtPeriodEnd: false,
    updatedAt: new Date(), // <------
  },
  where: [
    {
      field: "id",
      value: subscription.id,
    },
  ],
});

The updatedAt field is not mapped in either schema.ts or types.ts of the Stripe plugin.

Current vs. Expected behavior

Current Behavior
The plugin attempts to update a field (updatedAt) that is not declared in the schema definition. This results in runtime errors, especially for databases that do not use the default camelCase conversion.

Expected Behavior
The updatedAt field should be explicitly defined in the schema.ts and included in types.ts, ensuring compatibility with custom or snake_case naming strategies used in various databases.

What version of Better Auth are you using?

1.2.10

Provide environment information

- OS: Windows 11
- Browser: Chrome

Which area(s) are affected? (Select all that apply)

Package

Auth config (if applicable)


Additional context

No response

Originally created by @joaoseidel on GitHub (Jun 23, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/3138 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce A webhook call triggers the following error: ```shell 2025-06-23T06:00:57.826Z ERROR [Better Auth]: Stripe webhook failed. Error: Could not find property pointer for update shape key: 'updatedAt' ``` This happens in better-auth/packages/stripe/src/index.ts at: ```ts await ctx.context.adapter.update({ model: "subscription", update: { cancelAtPeriodEnd: false, updatedAt: new Date(), // <------ }, where: [ { field: "id", value: subscription.id, }, ], }); ``` The updatedAt field is not mapped in either schema.ts or types.ts of the Stripe plugin. ### Current vs. Expected behavior **Current Behavior** The plugin attempts to update a field (updatedAt) that is not declared in the schema definition. This results in runtime errors, especially for databases that do not use the default camelCase conversion. **Expected Behavior** The updatedAt field should be explicitly defined in the schema.ts and included in types.ts, ensuring compatibility with custom or snake_case naming strategies used in various databases. ### What version of Better Auth are you using? 1.2.10 ### Provide environment information ```bash - OS: Windows 11 - Browser: Chrome ``` ### Which area(s) are affected? (Select all that apply) Package ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-15 16:30:12 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 23, 2025):

Hi @joaoseidel! I'm Dosu and I’m helping the better-auth team.

The root cause is confirmed: the Stripe plugin's business logic tries to update the subscription's updatedAt field, but this field is missing from both schema.ts and types.ts, which leads to runtime errors—especially with custom or snake_case database strategies reference.

To fix this, add updatedAt to both files:

In packages/stripe/src/schema.ts, add:

updatedAt: {
  type: "date",
  required: false,
},

inside the fields object for the subscription model reference.

In packages/stripe/src/types.ts, add:

updatedAt?: Date;

to the Subscription interface reference.

This approach matches best practices seen elsewhere in Better Auth and ensures compatibility with both camelCase and snake_case naming strategies reference. If your database uses snake_case, make sure your schema generator or adapter maps updatedAt to updated_at as needed.

Once these changes are made, the runtime error should be resolved and your plugin will be compatible with custom naming strategies.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

<!-- gh-comment-id:2995094235 --> @dosubot[bot] commented on GitHub (Jun 23, 2025): <!-- Greeting --> Hi @joaoseidel! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> The root cause is confirmed: the Stripe plugin's business logic tries to update the subscription's updatedAt field, but this field is missing from both schema.ts and types.ts, which leads to runtime errors—especially with custom or snake_case database strategies [reference](https://github.com/better-auth/better-auth/blob/1eff55bde85427d6bb2fafdc8691c4af11fbc301/packages/stripe/src/index.ts). To fix this, add updatedAt to both files: **In `packages/stripe/src/schema.ts`**, add: ```ts updatedAt: { type: "date", required: false, }, ``` inside the `fields` object for the subscription model [reference](https://github.com/better-auth/better-auth/blob/1eff55bde85427d6bb2fafdc8691c4af11fbc301/packages/stripe/src/schema.ts). **In `packages/stripe/src/types.ts`**, add: ```ts updatedAt?: Date; ``` to the `Subscription` interface [reference](https://github.com/better-auth/better-auth/blob/1eff55bde85427d6bb2fafdc8691c4af11fbc301/packages/stripe/src/types.ts). This approach matches best practices seen elsewhere in Better Auth and ensures compatibility with both camelCase and snake_case naming strategies [reference](https://github.com/better-auth/better-auth/pull/1012). If your database uses snake_case, make sure your schema generator or adapter maps updatedAt to updated_at as needed. Once these changes are made, the runtime error should be resolved and your plugin will be compatible with custom naming strategies. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/59b3c019-858d-465d-8872-d00b46c61a37?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/59b3c019-858d-465d-8872-d00b46c61a37?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/59b3c019-858d-465d-8872-d00b46c61a37?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/59b3c019-858d-465d-8872-d00b46c61a37?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/59b3c019-858d-465d-8872-d00b46c61a37?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/59b3c019-858d-465d-8872-d00b46c61a37?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/59b3c019-858d-465d-8872-d00b46c61a37?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/3138)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#18119