red-gold-2376
03/15/2022, 9:37 PMtrue-myth
library
pulumi:pulumi:Stack (wordpress-dev):
TypeError: Symbol.prototype [ @@toPrimitive ] requires that 'this' be a Symbol: TypeError: Symbol.prototype [ @@toPrimitive ] requires that 'this' be a Symbol
at Symbol.[Symbol.toPrimitive] (<anonymous>)
at Object.<anonymous> (<anonymous>:64:21)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at requireFromString (/home/abukamel/codebases/work/iac/pulumi/programs/wordpress/node_modules/require-from-string/index.js:28:4)
at getProvider (/home/abukamel/codebases/work/iac/pulumi/programs/wordpress/node_modules/@pulumi/cmd/dynamic-provider/index.ts:66:20)
at Object.<anonymous> (/home/abukamel/codebases/work/iac/pulumi/programs/wordpress/node_modules/@pulumi/cmd/dynamic-provider/index.ts:116:26)
at Generator.next (<anonymous>)
at /home/abukamel/codebases/work/iac/pulumi/programs/wordpress/node_modules/@pulumi/pulumi/cmd/dynamic-provider/index.js:21:71
at new Promise (<anonymous>)
at __awaiter (/home/abukamel/codebases/work/iac/pulumi/programs/wordpress/node_modules/@pulumi/pulumi/cmd/dynamic-provider/index.js:17:12)
error: Symbol.prototype [ @@toPrimitive ] requires that 'this' be a Symbol
The code works normally if it was not used directly without pulumi.
export const getOrCreateMonitor = async (fqdn: string): Promise<Result<Monitor, string>> => {
await checkApiKey()
const currentMonitor = await getMonitor(fqdn)
if (currentMonitor.isOk) {
return currentMonitor
}
const alertContacts = await getAlertContacts()
if (alertContacts.isErr) {
return err(alertContacts.error)
}
const formattedAlertContacts = alertContacts.value.map((alertContact: AlertContact) => `${alertContact.id}_5_0`)
const requestData =
qs.stringify({
...sharedRequestData,
type: '1',
alert_contacts: formattedAlertContacts.join('-'),
friendly_name: fqdn,
url: `https://${fqdn}`
})
const response = await <http://axios.post|axios.post>(newMonitorUrl, requestData, sharedRequestConfig)
if (response.data.stat != 'ok') {
return err(response.data.error.message)
}
const newMonitor: Monitor = response.data.monitor
return ok(newMonitor)
}
Is there a way to fix this?