Skip to content

how to access a rawBody in an endpoint #10831

@jesuscovam

Description

@jesuscovam

Describe the bug

To validate a request from stripe, I have to provide them the rawBody of the request, but every try throws an error.

Screenshot 2023-10-04 at 5 39 10 p m

I have tried other solutions that I read in other issues that worked for some users but I couldn't make it work

Solution with text: #3384 (comment)

Solution with buffer: #3384 (comment)

I think we have the same error #10339

Reproduction

pnpm dev this sveltekit app repo

have installed the stripe-cli and have an user to test it download stripe cli

do the login for the stripe with stripe login

connect the cli with the server stripe listen --forward-to http://localhost:5173/api/with-buffer

in a another terminal run a stripe event, the one I use is payment.intent stripe trigger payment_intent.succeeded

you can also test the other method with stripe listen --forward-to http://localhost:5173/api/with-text

Logs

StripeSignatureVerificationError: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?

System Info

System:
    OS: macOS 14.0
    CPU: (8) arm64 Apple M1
    Memory: 45.23 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
    Yarn: 1.22.10 - /opt/homebrew/bin/yarn
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
    pnpm: 8.8.0 - ~/Library/pnpm/pnpm
    Watchman: 2023.05.22.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 117.0.5938.149
    Safari: 17.0
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.0
    @sveltejs/adapter-vercel: ^3.0.3 => 3.0.3
    @sveltejs/kit: ^1.20.4 => 1.25.1
    svelte: ^4.0.5 => 4.2.1
    vite: ^4.4.2 => 4.4.10

Severity

blocking an upgrade

Additional Information

No response

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