Actually, now that I look at it, I can see that your user-agent is “node”, which tells me this is probably done server side. Is that right?
If so, this would explain it, as you’ve probably only add the header (via CoreManager) on the client side and not on the server.
Regardless, I would strongly suggest that you not don’t call a cloud function with Parse.Cloud.run, from another cloud function as this makes a network request. It’s going to be a lot slower than simply calling the function directly on the server.
Here’s an example of how I’ve set my code up to get around this - in case you’re interested:
In my cloud.ts file, I expose a getPages
function as per normal and you can see that I’m importing it from a file called service
:
import * as pageService from './page-service'
Parse.Cloud.define('fetch-tenant-by-id', citizenService.fetchTenantById)
The service is really just a place where I marshal requests and format the response from my methods in a standard way:
import * as citizen from '../lib/citizen'
export const fetchTenantById = async (request: CloudRequest): Promise<CloudResponse> => {
await validateTenant(request)
if (!request.params.tenantId) {
throw new Error(CLOUD_PARAMS_MISSING)
}
const tenant = await citizen.fetchTenantById(request.params.tenantId)
return {
data: tenant
}
}
If you look in one of my earlier replies above, where I showed you my tenant validation code, you can see me using the same method just mentioned above, without the need for making a network request. Here it is again (from my validation method):
const tenant = await citizen.fetchTenantById(req.headers['x-tenant'])
I hope this helps? If I’ve made incorrect assumptions about where you’re running the code from, my apologies (Just thought making an assumption and giving a bit more detail might help save some time).