Website: Fix object mutation in receive-usage-analytics webhook. (#15185)

Closes: #15182

Changes:
- Updated the receive-usage-analytics webhook to create new database
records with a cloned `inputs` object. This prevents the JSON attributes
from being mutated into strings.
This commit is contained in:
Eric 2023-11-20 12:04:03 -06:00 committed by GitHub
parent 8ae88cfe1a
commit 9984bc6894
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,8 +39,8 @@ module.exports = {
fn: async function (inputs) {
// Create a database record for these usage statistics
await HistoricalUsageSnapshot.create(inputs);
// Create a database record for these usage statistics.
await HistoricalUsageSnapshot.create(Object.assign({}, inputs));
if(!sails.config.custom.datadogApiKey) {
throw new Error('No Datadog API key configured! (Please set sails.config.custom.datadogApiKey)');