diff --git a/packages/nodejs/.changesets/allow-sending-non-integer-values-in-data-maps.md b/packages/nodejs/.changesets/allow-sending-non-integer-values-in-data-maps.md new file mode 100644 index 00000000..77bdf20c --- /dev/null +++ b/packages/nodejs/.changesets/allow-sending-non-integer-values-in-data-maps.md @@ -0,0 +1,6 @@ +--- +bump: "patch" +type: "fix" +--- + +Fix an issue where the AppSignal extension would throw an error when an object containing a non-integer number is sent to it. This would be triggered when calling `setSampleData` with an object containing a non-integer number, or when the values for a metric's tags are non-integer numbers. diff --git a/packages/nodejs/ext/appsignal_extension.cpp b/packages/nodejs/ext/appsignal_extension.cpp index f97311b6..401409d4 100644 --- a/packages/nodejs/ext/appsignal_extension.cpp +++ b/packages/nodejs/ext/appsignal_extension.cpp @@ -182,7 +182,7 @@ Napi::Value SetFloatToDataMap(const Napi::CallbackInfo &info) { Napi::Number num = info[1].As(); Napi::External map = - info[1].As>(); + info[2].As>(); appsignal_data_map_set_float(map.Data(), MakeAppsignalString(key_utf8), num.DoubleValue()); diff --git a/packages/nodejs/src/__tests__/data.test.ts b/packages/nodejs/src/__tests__/data.test.ts index 6ef3fbae..a6737ea6 100644 --- a/packages/nodejs/src/__tests__/data.test.ts +++ b/packages/nodejs/src/__tests__/data.test.ts @@ -17,7 +17,7 @@ describe("Data", () => { const nested = { string: "payload", int: 9999, - float: 99.0, + float: 99.9, 1: true, null: "null_key", null_value: null, @@ -57,7 +57,7 @@ describe("Data", () => { false, "string", 9999, - 99.0, + 99.9, [1, 2, 3], { foo: "bʊr" }, { arr: [1, 2, "three"], foo: "bʊr" }