Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe plugin logs undefined as id on update - twice #10113

Open
max-degterev opened this issue Dec 20, 2024 · 0 comments
Open

Stripe plugin logs undefined as id on update - twice #10113

max-degterev opened this issue Dec 20, 2024 · 0 comments
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@max-degterev
Copy link

max-degterev commented Dec 20, 2024

Describe the Bug

2 bugs in 1, Christmas special!

  1. https://github.com/payloadcms/payload/blob/main/packages/plugin-stripe/src/hooks/createNewInStripe.ts#L70
    This should only cater for create action, instead it picks up update action, prints to console and does nothing. Just remove the whole update piece?

  2. https://github.com/payloadcms/payload/blob/main/packages/plugin-stripe/src/hooks/syncExistingWithStripe.ts#L54
    Looks like the _id property on originalDoc is undefined here. Leftover from v2?

See log output

  1. create call
  2. update call, tries to read id, can't
 POST /admin/collections/products/2 200 in 37ms
[23:37:55] INFO: A 'products' document has changed in Payload with ID: 'undefined', syncing with Stripe...
[23:37:55] INFO: A 'products' document has changed in Payload with ID: 'undefined', syncing with Stripe...
[23:37:55] INFO: - Syncing to Stripe resource with ID: 'prod_RR6yy2zDLbpBPU'...
[23:37:56] INFO: ✅ Successfully synced Stripe resource with ID: 'prod_RR6yy2zDLbpBPU'.

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/blob/main/packages/plugin-stripe/src/hooks/createNewInStripe.ts#L70
https://github.com/payloadcms/payload/blob/main/packages/plugin-stripe/src/hooks/syncExistingWithStripe.ts#L54

Reproduction Steps

  1. Use "@payloadcms/plugin-stripe": "^3.9.0",
  2. Try syncing a collection with stripe, for example products

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

plugin: stripe

Environment Info

Binaries:
  Node: 20.18.1
  npm: 10.9.1
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.9.0
  next: 15.1.2
  @payloadcms/db-postgres: 3.9.0
  @payloadcms/email-nodemailer: 3.9.0
  @payloadcms/graphql: 3.9.0
  @payloadcms/next/utilities: 3.9.0
  @payloadcms/plugin-cloud-storage: 3.9.0
  @payloadcms/plugin-stripe: 3.9.0
  @payloadcms/richtext-lexical: 3.9.0
  @payloadcms/storage-s3: 3.9.0
  @payloadcms/translations: 3.9.0
  @payloadcms/ui/shared: 3.9.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:11 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6020
  Available memory (MB): 32768
  Available CPU cores: 12
@max-degterev max-degterev added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Dec 20, 2024
@max-degterev max-degterev changed the title Stripe plugin logs undefined as id Stripe plugin logs undefined as id on update - twice Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

2 participants
@max-degterev and others