Hello, I have two hubspot apps that we created to add custom workflow extensions. Each uses a select dropdown field that grabs its data from an external API call. Both have the exact same type defenition, pointing to the same URL for the source info. The payload that we give back is agnostic to the app, and only sees user. For both, the function is defined as follows:
"functions": [
{
"functionType": "POST_FETCH_OPTIONS",
"id": "endpoint_id",
"functionSource": "exports.main = (response, callback) => {\n return callback(transformResponse(response));\n};\n\nfunction transformResponse(response) {\n let body = JSON.parse(response.responseBody);\n\n // External value fields in multi value fields in custom actions v1 were\n // migrated to have a key like v1FieldKey__hs1 in custom actions v2\n let fieldKey = response.fieldKey.replace(/__hs[0-9]+/, '');\n\n if (!body.options || !(fieldKey in body.options)) {\n return { options: [] };\n }\n\n let options = [];\n for (const label in body.options[fieldKey]) {\n options.push({\n label,\n value: body.options[fieldKey][label]\n });\n }\n\n return { options };\n}\n"
}
App A works. App B does not. Each time I load the workflow tool I get the error "options could not load due to a 3rd-party API failure". I am at a legit loss on how to proceed.