Back

Function body not being parsed

  • 0
  • Functions
  • Cloud
Brinamite
4 Feb, 2025, 08:46

Hi, I am having this weird issue where the body passed to the function is not being parsed.

I am following the template example of Payments With Stripe, extending it to receive line items.

Relevant code is as follows:

TypeScript
const fallbackUrl = req.scheme + '://' + req.headers['host'] + '/';
      log(req.body);
      const successUrl = req.body?.successUrl ?? fallbackUrl;
      const failureUrl = req.body?.failureUrl ?? fallbackUrl;
      const currency = req.body?.currency ?? 'eur';
      const product = req.body['product'];
      const quantity = req.body?.quantity ?? 1;
      log({ successUrl, failureUrl, currency, product, quantity });

log is as follows:

TypeScript
{"successUrl":"https://[[domain]]/credits/return",
"failureUrl":"https://[[domain]]/credits/return",
"product":"price_1PP*****************",
"quantity":1,
"currency":"eur"}

{"successUrl":"http://cloud.appwrite.io/",
"failureUrl":"http://cloud.appwrite.io/",
"currency":"eur",
"quantity":1}

I have no clue why nothing is being read at this point. Let me know if more context is needed

TL;DR
Developers are having issues parsing the body passed to the function when trying to extend a template example of Payments With Stripe to receive line items. The relevant code provided does not seem to be properly parsing the body to retrieve the necessary data. The issue might lie in how the data is being passed or read within the function. Double-check the data passing and retrieval process to ensure everything is being handled correctly.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more