I am trying to call a second function from within another app service function. I do a findOneAndReplace in my current function and get the document back. By default, it is in EJSON. I then pass this as a param to my second function via context.functions.execute(‘second function’, doc). Inside of this second function I use the http service to send a POST request to an external service. No matter what I do, JSON.stringify(), parse, or any combination the payload I sent in the POST is ALWAYS in EJSON and causes errors in the downstream system since it has no idea what the types are.
Is it not possible to convert the EJSON to a pure JSON object? The docs mention using stringify, which yes if you log it out in the function the stringified result looks correct, but I cannot get it converted to a JSON object even running JSON.parse(JSON.stringify(doc)). ALWAYS EJSON.
I always have encodeBodyAsJSON set on the http POST