From 9028b4bd108ce9008f672bb650b8b89464b5de7f Mon Sep 17 00:00:00 2001 From: rochdev Date: Wed, 11 Sep 2024 18:36:05 -0400 Subject: [PATCH 01/26] add crash report test for the receiver --- Cargo.lock | 54 +- crates/crashtracker/Cargo.toml | 2 +- load.js | 11 +- package-lock.json | 8 +- test/crashtracker.js | 30 -- test/crashtracker/.gitignore | 2 + test/crashtracker/Cargo.lock | 264 ++++++++++ test/crashtracker/Cargo.toml | 15 + test/crashtracker/app.js | 35 ++ test/crashtracker/index.js | 52 ++ test/crashtracker/package-lock.json | 750 ++++++++++++++++++++++++++++ test/crashtracker/package.json | 14 + test/crashtracker/src/lib.rs | 8 + 13 files changed, 1193 insertions(+), 52 deletions(-) delete mode 100644 test/crashtracker.js create mode 100644 test/crashtracker/.gitignore create mode 100644 test/crashtracker/Cargo.lock create mode 100644 test/crashtracker/Cargo.toml create mode 100644 test/crashtracker/app.js create mode 100644 test/crashtracker/index.js create mode 100644 test/crashtracker/package-lock.json create mode 100644 test/crashtracker/package.json create mode 100644 test/crashtracker/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 547dde8..265b4c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "ahash" version = "0.7.8" @@ -101,7 +107,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] @@ -149,13 +155,15 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "blazesym" -version = "0.2.0-rc.0" -source = "git+https://github.com/libbpf/blazesym.git?rev=v0.2.0-rc.0#2f393f66a448f46ea71889e81a8866799762463d" +version = "0.2.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d750f0052cfee86c14cbc31eda95c14271e16347196fd4902df1a52e4411a090" dependencies = [ "cpp_demangle", - "gimli 0.30.0", + "gimli 0.31.0", "libc", - "miniz_oxide", + "memmap2", + "miniz_oxide 0.8.0", "rustc-demangle", ] @@ -341,7 +349,7 @@ dependencies = [ [[package]] name = "datadog-crashtracker" version = "12.0.0" -source = "git+https://github.com/DataDog/libdatadog.git?branch=main#16528ffee456f7af5fe9ad80a6294fb5dcd38918" +source = "git+https://github.com/DataDog/libdatadog.git?branch=main#54ed2cfcc583e57b366078b5952793f9e6db0c8f" dependencies = [ "anyhow", "backtrace", @@ -366,7 +374,7 @@ dependencies = [ [[package]] name = "datadog-ddsketch" version = "12.0.0" -source = "git+https://github.com/DataDog/libdatadog.git?branch=main#16528ffee456f7af5fe9ad80a6294fb5dcd38918" +source = "git+https://github.com/DataDog/libdatadog.git?branch=main#54ed2cfcc583e57b366078b5952793f9e6db0c8f" dependencies = [ "prost", ] @@ -437,7 +445,7 @@ dependencies = [ [[package]] name = "ddcommon" version = "12.0.0" -source = "git+https://github.com/DataDog/libdatadog.git?branch=main#16528ffee456f7af5fe9ad80a6294fb5dcd38918" +source = "git+https://github.com/DataDog/libdatadog.git?branch=main#54ed2cfcc583e57b366078b5952793f9e6db0c8f" dependencies = [ "anyhow", "futures", @@ -449,6 +457,7 @@ dependencies = [ "hyper-rustls 0.27.2", "hyper-util", "lazy_static", + "libc", "log", "pin-project", "regex", @@ -458,12 +467,13 @@ dependencies = [ "static_assertions", "tokio", "tokio-rustls 0.26.0", + "windows-sys 0.52.0", ] [[package]] name = "ddtelemetry" version = "12.0.0" -source = "git+https://github.com/DataDog/libdatadog.git?branch=main#16528ffee456f7af5fe9ad80a6294fb5dcd38918" +source = "git+https://github.com/DataDog/libdatadog.git?branch=main#54ed2cfcc583e57b366078b5952793f9e6db0c8f" dependencies = [ "anyhow", "base64 0.22.1", @@ -527,7 +537,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.7.4", ] [[package]] @@ -650,9 +660,9 @@ checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "gimli" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e1d97fbe9722ba9bbd0c97051c2956e726562b61f86a25a4360398a40edfc9" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" dependencies = [ "fallible-iterator", "indexmap", @@ -973,6 +983,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memmap2" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" +dependencies = [ + "libc", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -986,6 +1005,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", "simd-adler32", ] @@ -1046,8 +1074,6 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "regex", - "semver", "syn 2.0.72", ] diff --git a/crates/crashtracker/Cargo.toml b/crates/crashtracker/Cargo.toml index ec398a5..a889faf 100644 --- a/crates/crashtracker/Cargo.toml +++ b/crates/crashtracker/Cargo.toml @@ -16,4 +16,4 @@ path = "src/bin/receiver.rs" anyhow = "1" datadog-crashtracker = { git = "https://github.com/DataDog/libdatadog.git", branch = "main" } napi = { version = "2", features = ["serde-json"] } -napi-derive = { version = "2" } +napi-derive = { version = "2", default-features = false } diff --git a/load.js b/load.js index 6c7b41e..b808c4f 100644 --- a/load.js +++ b/load.js @@ -52,10 +52,15 @@ function find (name, binary = false) { } function findFolder (root) { - const folders = readdirSync(path.join(root, 'prebuilds')) + try { + const prebuilds = path.join(root, 'prebuilds') + const folders = readdirSync(prebuilds) - return folders.find(f => f === `${PLATFORM}${LIBC}-${ARCH}`) - || folders.find(f => f === `${PLATFORM}-${ARCH}`) + return folders.find(f => f === `${PLATFORM}${LIBC}-${ARCH}`) + || folders.find(f => f === `${PLATFORM}-${ARCH}`) + } catch (e) { + return null + } } function findFile (root, name, binary = false) { diff --git a/package-lock.json b/package-lock.json index 796ca79..cb8631e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "libdatadog", - "version": "0.1.0", + "name": "@datadog/libdatadog", + "version": "0.1.0-pre", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "libdatadog", - "version": "0.1.0", + "name": "@datadog/libdatadog", + "version": "0.1.0-pre", "license": "Apache-2.0" } } diff --git a/test/crashtracker.js b/test/crashtracker.js deleted file mode 100644 index 66dedac..0000000 --- a/test/crashtracker.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict' - -const libdatadog = require('..') -const crashtracker = libdatadog.load('crashtracker') - -crashtracker.initWithReceiver({ - additional_files: [], - create_alt_stack: false, - endpoint: { - url: { - scheme: 'http', - authority: 'localhost:8126', - path_and_query: '' - }, - timeout_ms: 3000 - }, - resolve_frames: 'Disabled', - wait_for_receiver: false -}, { - args: [], - env: [], - path_to_receiver_binary: libdatadog.find('crashtracker-receiver', true), - stderr_filename: null, - stdout_filename: null, -}, { - library_name: "dd-trace-js", - library_version: '0.0.0', - family: 'nodejs', - tags: [] -}) diff --git a/test/crashtracker/.gitignore b/test/crashtracker/.gitignore new file mode 100644 index 0000000..be311a7 --- /dev/null +++ b/test/crashtracker/.gitignore @@ -0,0 +1,2 @@ +index.d.ts +index.node diff --git a/test/crashtracker/Cargo.lock b/test/crashtracker/Cargo.lock new file mode 100644 index 0000000..3ed1c9f --- /dev/null +++ b/test/crashtracker/Cargo.lock @@ -0,0 +1,264 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "ctor" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "napi" +version = "2.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1277600d452e570cc83cf5f4e8efb389cc21e5cbefadcfba7239f4551e2e3e99" +dependencies = [ + "bitflags", + "ctor", + "napi-derive", + "napi-sys", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "napi-derive" +version = "2.16.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "150d87c4440b9f4815cb454918db498b5aae9a57aa743d20783fe75381181d01" +dependencies = [ + "cfg-if", + "convert_case", + "napi-derive-backend", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "napi-derive-backend" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cd81b794fc1d6051acf8c4f3cb4f82833b0621272a232b4ff0cf3df1dbddb61" +dependencies = [ + "convert_case", + "once_cell", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "napi-sys" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427802e8ec3a734331fec1035594a210ce1ff4dc5bc1950530920ab717964ea3" +dependencies = [ + "libloading", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "segfault" +version = "0.1.0" +dependencies = [ + "napi", + "napi-derive", +] + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "syn" +version = "2.0.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/test/crashtracker/Cargo.toml b/test/crashtracker/Cargo.toml new file mode 100644 index 0000000..9e78a15 --- /dev/null +++ b/test/crashtracker/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "segfault" +version = "0.1.0" +edition = "2018" + +[lib] +crate-type = ["cdylib"] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[workspace] + +[dependencies] +napi = { version = "2", features = ["serde-json"] } +napi-derive = { version = "2", default-features = false } diff --git a/test/crashtracker/app.js b/test/crashtracker/app.js new file mode 100644 index 0000000..6c9a681 --- /dev/null +++ b/test/crashtracker/app.js @@ -0,0 +1,35 @@ +'use strict' + +const os = require('os') +const libdatadog = require('../..') +const crashtracker = libdatadog.load('crashtracker') + +crashtracker.initWithReceiver({ + additional_files: [], + create_alt_stack: false, + endpoint: { + url: { + scheme: 'http', + authority: `127.0.0.1:${process.env.PORT || 8126}`, + path_and_query: '' + }, + timeout_ms: 3000 + }, + resolve_frames: os.platform() === 'linux' + ? 'EnabledWithSymbolsInReceiver' + : 'EnabledWithInprocessSymbols', + wait_for_receiver: true +}, { + args: [], + env: [], + path_to_receiver_binary: libdatadog.find('crashtracker-receiver', true), + stderr_filename: 'stderr.log', + stdout_filename: 'stdout.log', +}, { + library_name: 'dd-trace-js', + library_version: '6.0.0-pre', + family: 'nodejs', + tags: ['foo:bar', 'baz:qux'] +}) + +require('./index.node').boom() diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js new file mode 100644 index 0000000..0604b77 --- /dev/null +++ b/test/crashtracker/index.js @@ -0,0 +1,52 @@ +'use strict' + +const { execSync } = require('child_process') +const express = require('express') +const bodyParser = require('body-parser') + +const cwd = __dirname + +execSync('npm install --silent', { cwd }) +execSync('npm run --silent build', { cwd }) + +const app = express() + +let timeout = setTimeout(() => { + throw new Error('No crash report received before timing out.') +}, 5000) + +app.use(bodyParser.json()) + +app.post('/telemetry/proxy/api/v2/apmtelemetry', (req, res) => { + clearTimeout(timeout) + + res.status(200).send() + + server.close(() => { + const stackTrace = JSON.parse(req.body.payload[0].stack_trace) + const boomFrame = stackTrace.find(frame => frame.names[0].name.includes('boom')) + + if (!boomFrame) { + throw new Error('Could not find a stack frame for the crashing function.') + } + }) +}) + +const server = app.listen(() => { + const PORT = server.address().port + + try { + execSync('node app', { + cwd, + stdio: ['inherit', 'inherit', 'inherit'], + env: { + ...process.env, + PORT + } + }) + } catch (e) { + if (e.signal !== 'SIGSEGV') { + throw e + } + } +}) diff --git a/test/crashtracker/package-lock.json b/test/crashtracker/package-lock.json new file mode 100644 index 0000000..8a7e4a0 --- /dev/null +++ b/test/crashtracker/package-lock.json @@ -0,0 +1,750 @@ +{ + "name": "crashtracker", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "body-parser": "^1.20.3", + "express": "^4.19.2" + }, + "devDependencies": { + "@napi-rs/cli": "^2.18.4" + } + }, + "node_modules/@napi-rs/cli": { + "version": "2.18.4", + "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.18.4.tgz", + "integrity": "sha512-SgJeA4df9DE2iAEpr3M2H0OKl/yjtg1BnRI5/JyowS71tUWhrfSu2LT0V3vlHET+g1hBVlrO60PmEXwUEKp8Mg==", + "dev": true, + "bin": { + "napi": "scripts/index.js" + }, + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/body-parser": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/body-parser/node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.2", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.6.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/express/node_modules/body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + } + } +} diff --git a/test/crashtracker/package.json b/test/crashtracker/package.json new file mode 100644 index 0000000..23bd847 --- /dev/null +++ b/test/crashtracker/package.json @@ -0,0 +1,14 @@ +{ + "private": true, + "main": "index.js", + "scripts": { + "build": "napi build" + }, + "dependencies": { + "body-parser": "^1.20.3", + "express": "^4.19.2" + }, + "devDependencies": { + "@napi-rs/cli": "^2.18.4" + } +} diff --git a/test/crashtracker/src/lib.rs b/test/crashtracker/src/lib.rs new file mode 100644 index 0000000..4b5314b --- /dev/null +++ b/test/crashtracker/src/lib.rs @@ -0,0 +1,8 @@ +use napi_derive::napi; + +#[napi] +pub fn boom() -> napi::Result<()> { + unsafe { std::ptr::null_mut::().write(42) }; + + Ok(()) +} From f04ed627ba8eb6ce53a2ec5f577239384e063db9 Mon Sep 17 00:00:00 2001 From: rochdev Date: Wed, 11 Sep 2024 18:46:24 -0400 Subject: [PATCH 02/26] fix import order --- test/crashtracker/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 0604b77..d3794af 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -1,14 +1,14 @@ 'use strict' -const { execSync } = require('child_process') -const express = require('express') -const bodyParser = require('body-parser') - const cwd = __dirname execSync('npm install --silent', { cwd }) execSync('npm run --silent build', { cwd }) +const { execSync } = require('child_process') +const express = require('express') +const bodyParser = require('body-parser') + const app = express() let timeout = setTimeout(() => { From 0c258c3a001bf9c82d106f756b73ff0fc38fb28b Mon Sep 17 00:00:00 2001 From: rochdev Date: Wed, 11 Sep 2024 18:53:39 -0400 Subject: [PATCH 03/26] fix import order --- test/crashtracker/index.js | 6 +----- test/crashtracker/setup.js | 8 ++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 test/crashtracker/setup.js diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index d3794af..064a05f 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -1,11 +1,7 @@ 'use strict' -const cwd = __dirname +require('./setup') -execSync('npm install --silent', { cwd }) -execSync('npm run --silent build', { cwd }) - -const { execSync } = require('child_process') const express = require('express') const bodyParser = require('body-parser') diff --git a/test/crashtracker/setup.js b/test/crashtracker/setup.js new file mode 100644 index 0000000..15b5838 --- /dev/null +++ b/test/crashtracker/setup.js @@ -0,0 +1,8 @@ +'use strict' + +const { execSync } = require('child_process') + +const cwd = __dirname + +execSync('npm install --silent', { cwd }) +execSync('npm run --silent build', { cwd }) From 67b66fffe359779d514c27c75aab3d3cf2886a58 Mon Sep 17 00:00:00 2001 From: rochdev Date: Wed, 11 Sep 2024 19:20:25 -0400 Subject: [PATCH 04/26] fix import order --- test/crashtracker/index.js | 10 ++++++++-- test/crashtracker/setup.js | 8 -------- 2 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 test/crashtracker/setup.js diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 064a05f..ecd4192 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -1,6 +1,12 @@ 'use strict' -require('./setup') +const { execSync } = require('child_process') + +const cwd = __dirname +const stdio = ['inherit', 'inherit', 'inherit'] + +execSync('npm install --silent', { cwd, stdio }) +execSync('npm run --silent build', { cwd, stdio }) const express = require('express') const bodyParser = require('body-parser') @@ -34,7 +40,7 @@ const server = app.listen(() => { try { execSync('node app', { cwd, - stdio: ['inherit', 'inherit', 'inherit'], + stdio, env: { ...process.env, PORT diff --git a/test/crashtracker/setup.js b/test/crashtracker/setup.js deleted file mode 100644 index 15b5838..0000000 --- a/test/crashtracker/setup.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' - -const { execSync } = require('child_process') - -const cwd = __dirname - -execSync('npm install --silent', { cwd }) -execSync('npm run --silent build', { cwd }) From 30ffc23cc01b3588000cc63ee19adc6b816f3b3f Mon Sep 17 00:00:00 2001 From: rochdev Date: Wed, 11 Sep 2024 19:34:06 -0400 Subject: [PATCH 05/26] fix missing rust --- test/crashtracker/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index ecd4192..1812bf4 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -5,6 +5,7 @@ const { execSync } = require('child_process') const cwd = __dirname const stdio = ['inherit', 'inherit', 'inherit'] +execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -y --verbose`, { cwd, stdio }) execSync('npm install --silent', { cwd, stdio }) execSync('npm run --silent build', { cwd, stdio }) From 53f6e168c957e9e8e8a9efab8bb4c4da92dc01ad Mon Sep 17 00:00:00 2001 From: rochdev Date: Wed, 11 Sep 2024 19:47:51 -0400 Subject: [PATCH 06/26] fix command --- test/crashtracker/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 1812bf4..ab3ad07 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -5,7 +5,10 @@ const { execSync } = require('child_process') const cwd = __dirname const stdio = ['inherit', 'inherit', 'inherit'] -execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -y --verbose`, { cwd, stdio }) +if (process.env.CI) { + execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --verbose`, { cwd, stdio }) +} + execSync('npm install --silent', { cwd, stdio }) execSync('npm run --silent build', { cwd, stdio }) From e6de8cafc6dd3af692d850181b15f68510b33a6a Mon Sep 17 00:00:00 2001 From: rochdev Date: Wed, 11 Sep 2024 19:56:25 -0400 Subject: [PATCH 07/26] bump node --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1701873..0e565ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: with: package-manager: 'npm' cache: false - min-node-version: 14 + min-node-version: 16 rust: true only: linux-arm64,linux-x64,linuxmusl-arm64,linuxmusl-x64 From df5f09ce09174b778f23090933064e67cb47d4d6 Mon Sep 17 00:00:00 2001 From: rochdev Date: Wed, 11 Sep 2024 20:07:08 -0400 Subject: [PATCH 08/26] fix linux --- test/crashtracker/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index ab3ad07..54c5b00 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -51,7 +51,7 @@ const server = app.listen(() => { } }) } catch (e) { - if (e.signal !== 'SIGSEGV') { + if (e.signal !== 'SIGSEGV' && e.status !== 139) { throw e } } From d581c14414616a029d19aa021ad3764e92dfce09 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 09:37:45 -0400 Subject: [PATCH 09/26] debug --- test/crashtracker/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 54c5b00..ad45c46 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -18,6 +18,9 @@ const bodyParser = require('body-parser') const app = express() let timeout = setTimeout(() => { + execSync('cat stdout.json', { cwd, stdio }) + execSync('cat stderr.json', { cwd, stdio }) + throw new Error('No crash report received before timing out.') }, 5000) From 0fae3f20df94170ea768e6b3f6a947dfd02e4c43 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 09:46:13 -0400 Subject: [PATCH 10/26] debug --- test/crashtracker/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index ad45c46..2a365c8 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -54,6 +54,7 @@ const server = app.listen(() => { } }) } catch (e) { + console.log(e) if (e.signal !== 'SIGSEGV' && e.status !== 139) { throw e } From aaf497a114988aef92f05793a218c3b22e945aa0 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 09:55:53 -0400 Subject: [PATCH 11/26] debug --- test/crashtracker/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 2a365c8..3e52c43 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -18,8 +18,8 @@ const bodyParser = require('body-parser') const app = express() let timeout = setTimeout(() => { - execSync('cat stdout.json', { cwd, stdio }) - execSync('cat stderr.json', { cwd, stdio }) + execSync('cat stdout.log', { cwd, stdio }) + execSync('cat stderr.log', { cwd, stdio }) throw new Error('No crash report received before timing out.') }, 5000) From 979f27a52758715fda3225f5becf545911451964 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 09:56:12 -0400 Subject: [PATCH 12/26] debug --- test/crashtracker/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 3e52c43..24d237f 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -54,7 +54,6 @@ const server = app.listen(() => { } }) } catch (e) { - console.log(e) if (e.signal !== 'SIGSEGV' && e.status !== 139) { throw e } From d37749e77ab4f69c00e20d670869ee833f98f0a9 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 10:06:11 -0400 Subject: [PATCH 13/26] always use in-process symbols --- test/crashtracker/app.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/crashtracker/app.js b/test/crashtracker/app.js index 6c9a681..4d4b0eb 100644 --- a/test/crashtracker/app.js +++ b/test/crashtracker/app.js @@ -15,9 +15,7 @@ crashtracker.initWithReceiver({ }, timeout_ms: 3000 }, - resolve_frames: os.platform() === 'linux' - ? 'EnabledWithSymbolsInReceiver' - : 'EnabledWithInprocessSymbols', + resolve_frames: 'EnabledWithInprocessSymbols', wait_for_receiver: true }, { args: [], From a981036bff07e3e8e70b08a7644f94da212c45ec Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 13:02:56 -0400 Subject: [PATCH 14/26] install default crypto provider manually --- Cargo.lock | 1 + crates/crashtracker/Cargo.toml | 1 + crates/crashtracker/src/bin/receiver.rs | 2 ++ test/crashtracker/index.js | 4 ++-- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 265b4c2..54c7653 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -307,6 +307,7 @@ dependencies = [ "datadog-crashtracker", "napi", "napi-derive", + "rustls 0.23.12", ] [[package]] diff --git a/crates/crashtracker/Cargo.toml b/crates/crashtracker/Cargo.toml index a889faf..946d87c 100644 --- a/crates/crashtracker/Cargo.toml +++ b/crates/crashtracker/Cargo.toml @@ -17,3 +17,4 @@ anyhow = "1" datadog-crashtracker = { git = "https://github.com/DataDog/libdatadog.git", branch = "main" } napi = { version = "2", features = ["serde-json"] } napi-derive = { version = "2", default-features = false } +rustls = { version = "*", default-features = false, features = ["aws-lc-rs"] } diff --git a/crates/crashtracker/src/bin/receiver.rs b/crates/crashtracker/src/bin/receiver.rs index f84198b..837e824 100644 --- a/crates/crashtracker/src/bin/receiver.rs +++ b/crates/crashtracker/src/bin/receiver.rs @@ -3,5 +3,7 @@ fn main() {} #[cfg(unix)] fn main() -> anyhow::Result<()> { + // TODO: remove this line when the receiver default provider is fixed + rustls::crypto::aws_lc_rs::default_provider().install_default().unwrap(); datadog_crashtracker::receiver_entry_point_stdin() } diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 24d237f..a430ae8 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -22,7 +22,7 @@ let timeout = setTimeout(() => { execSync('cat stderr.log', { cwd, stdio }) throw new Error('No crash report received before timing out.') -}, 5000) +}, 10000) // TODO: reduce this when the receiver no longer locks up app.use(bodyParser.json()) @@ -33,7 +33,7 @@ app.post('/telemetry/proxy/api/v2/apmtelemetry', (req, res) => { server.close(() => { const stackTrace = JSON.parse(req.body.payload[0].stack_trace) - const boomFrame = stackTrace.find(frame => frame.names[0].name.includes('boom')) + const boomFrame = stackTrace.find(frame => frame.names[0]?.name.includes('boom')) if (!boomFrame) { throw new Error('Could not find a stack frame for the crashing function.') From f49736c369b47f1b2580eeeeb74675c2997dbc0d Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 13:30:50 -0400 Subject: [PATCH 15/26] fix cargo on alpine --- test/crashtracker/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index a430ae8..49883c6 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -1,12 +1,14 @@ 'use strict' const { execSync } = require('child_process') +const os = require('os') const cwd = __dirname const stdio = ['inherit', 'inherit', 'inherit'] if (process.env.CI) { execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --verbose`, { cwd, stdio }) + process.env.PATH = `:${os.homedir()}/.cargo/bin:${process.env.PATH}"` } execSync('npm install --silent', { cwd, stdio }) From 297f183d16bb3d3c444a34533b96116362adf0bb Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 13:31:15 -0400 Subject: [PATCH 16/26] fix cargo on alpine --- test/crashtracker/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 49883c6..4c08dfc 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -8,7 +8,7 @@ const stdio = ['inherit', 'inherit', 'inherit'] if (process.env.CI) { execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --verbose`, { cwd, stdio }) - process.env.PATH = `:${os.homedir()}/.cargo/bin:${process.env.PATH}"` + process.env.PATH = `${os.homedir()}/.cargo/bin:${process.env.PATH}` } execSync('npm install --silent', { cwd, stdio }) From 343aa5107aab8f301000700f38285c6abeb3dc50 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 13:49:04 -0400 Subject: [PATCH 17/26] fix cargo on alpine --- test/crashtracker/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 4c08dfc..cd94053 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -1,6 +1,7 @@ 'use strict' const { execSync } = require('child_process') +const { existsSync } = require('fs') const os = require('os') const cwd = __dirname @@ -8,7 +9,10 @@ const stdio = ['inherit', 'inherit', 'inherit'] if (process.env.CI) { execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --verbose`, { cwd, stdio }) - process.env.PATH = `${os.homedir()}/.cargo/bin:${process.env.PATH}` + + if (existsSync('/etc/alpine-release')) { + process.env.PATH = `/root/.cargo/bin:${process.env.PATH}` + } } execSync('npm install --silent', { cwd, stdio }) From d7af752f5a27ce5301948864d20818bc14d64e02 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 14:00:00 -0400 Subject: [PATCH 18/26] fix cargo on alpine --- test/crashtracker/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index cd94053..332da9f 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -10,13 +10,13 @@ const stdio = ['inherit', 'inherit', 'inherit'] if (process.env.CI) { execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --verbose`, { cwd, stdio }) - if (existsSync('/etc/alpine-release')) { - process.env.PATH = `/root/.cargo/bin:${process.env.PATH}` - } + // if (existsSync('/etc/alpine-release')) { + // process.env.PATH = `/root/.cargo/bin:${process.env.PATH}` + // } } execSync('npm install --silent', { cwd, stdio }) -execSync('npm run --silent build', { cwd, stdio }) +execSync('. $HOME/.cargo/env && npm run --silent build', { cwd, stdio }) const express = require('express') const bodyParser = require('body-parser') From 3017ea8cd858f08f51ca40106c32d7cb91ed9fdb Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 14:11:55 -0400 Subject: [PATCH 19/26] debug --- test/crashtracker/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 332da9f..9752589 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -15,7 +15,7 @@ if (process.env.CI) { // } } -execSync('npm install --silent', { cwd, stdio }) +execSync('npm install', { cwd, stdio }) execSync('. $HOME/.cargo/env && npm run --silent build', { cwd, stdio }) const express = require('express') From 1f59940ba3af7a6b6b786110da00547393b757c8 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 14:50:18 -0400 Subject: [PATCH 20/26] fix cargo on alpine --- test/crashtracker/index.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 9752589..995a919 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -2,21 +2,23 @@ const { execSync } = require('child_process') const { existsSync } = require('fs') -const os = require('os') const cwd = __dirname const stdio = ['inherit', 'inherit', 'inherit'] +const uid = process.getuid() +const gid = process.getgid() +const opts = { cwd, stdio, uid, gid } if (process.env.CI) { - execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --verbose`, { cwd, stdio }) + execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --verbose`, opts) - // if (existsSync('/etc/alpine-release')) { - // process.env.PATH = `/root/.cargo/bin:${process.env.PATH}` - // } + if (existsSync('/etc/alpine-release')) { + process.env.PATH = `/root/.cargo/bin:${process.env.PATH}` + } } -execSync('npm install', { cwd, stdio }) -execSync('. $HOME/.cargo/env && npm run --silent build', { cwd, stdio }) +execSync('npm install', opts) +execSync('npm run --silent build', opts) const express = require('express') const bodyParser = require('body-parser') @@ -24,8 +26,8 @@ const bodyParser = require('body-parser') const app = express() let timeout = setTimeout(() => { - execSync('cat stdout.log', { cwd, stdio }) - execSync('cat stderr.log', { cwd, stdio }) + execSync('cat stdout.log', opts) + execSync('cat stderr.log', opts) throw new Error('No crash report received before timing out.') }, 10000) // TODO: reduce this when the receiver no longer locks up @@ -52,8 +54,7 @@ const server = app.listen(() => { try { execSync('node app', { - cwd, - stdio, + ...opts, env: { ...process.env, PORT From fb1d5b07ecc118923d6a8ad7cfc4e009f5e88986 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 15:00:07 -0400 Subject: [PATCH 21/26] fix cargo on alpine --- test/crashtracker/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 995a919..12ddf0d 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -12,13 +12,13 @@ const opts = { cwd, stdio, uid, gid } if (process.env.CI) { execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --verbose`, opts) - if (existsSync('/etc/alpine-release')) { - process.env.PATH = `/root/.cargo/bin:${process.env.PATH}` - } + // if (existsSync('/etc/alpine-release')) { + // process.env.PATH = `/root/.cargo/bin:${process.env.PATH}` + // } } execSync('npm install', opts) -execSync('npm run --silent build', opts) +execSync('. $HOME/.cargo/bin && npm run --silent build', opts) const express = require('express') const bodyParser = require('body-parser') From f465fba327cbcbe23097e9854cd0650db95e9314 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 15:00:20 -0400 Subject: [PATCH 22/26] fix typo --- test/crashtracker/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 12ddf0d..f10c0d1 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -18,7 +18,7 @@ if (process.env.CI) { } execSync('npm install', opts) -execSync('. $HOME/.cargo/bin && npm run --silent build', opts) +execSync('. $HOME/.cargo/env && npm run --silent build', opts) const express = require('express') const bodyParser = require('body-parser') From 27e3bb361d8718b93a7edf22549217b00bf1ccaa Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 12 Sep 2024 15:09:49 -0400 Subject: [PATCH 23/26] fix cargo on alpine --- test/crashtracker/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index f10c0d1..4eb566f 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -9,6 +9,8 @@ const uid = process.getuid() const gid = process.getgid() const opts = { cwd, stdio, uid, gid } +execSync('npm install', opts) + if (process.env.CI) { execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --verbose`, opts) @@ -17,7 +19,6 @@ if (process.env.CI) { // } } -execSync('npm install', opts) execSync('. $HOME/.cargo/env && npm run --silent build', opts) const express = require('express') From 856c7c5a8864b6c302c7feb62299e7e972d168b8 Mon Sep 17 00:00:00 2001 From: rochdev Date: Fri, 13 Sep 2024 19:06:58 -0400 Subject: [PATCH 24/26] remove alpine for now and add macos --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- test/crashtracker/index.js | 9 ++------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0e565ec..b9cd9b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: cache: false min-node-version: 16 rust: true - only: linux-arm64,linux-x64,linuxmusl-arm64,linuxmusl-x64 + only: darwin-arm64,darwin-x64,linux-arm64,linux-x64 package-size: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a8fce2c..8139126 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: cache: false min-node-version: 14 rust: true - only: linux-arm64,linux-x64,linuxmusl-arm64,linuxmusl-x64 + only: darwin-arm64,darwin-x64,linux-arm64,linux-x64 publish: runs-on: ubuntu-latest diff --git a/test/crashtracker/index.js b/test/crashtracker/index.js index 4eb566f..4604195 100644 --- a/test/crashtracker/index.js +++ b/test/crashtracker/index.js @@ -9,17 +9,12 @@ const uid = process.getuid() const gid = process.getgid() const opts = { cwd, stdio, uid, gid } -execSync('npm install', opts) - if (process.env.CI) { execSync(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --verbose`, opts) - - // if (existsSync('/etc/alpine-release')) { - // process.env.PATH = `/root/.cargo/bin:${process.env.PATH}` - // } } -execSync('. $HOME/.cargo/env && npm run --silent build', opts) +execSync('npm install', opts) +execSync('npm run --silent build', opts) const express = require('express') const bodyParser = require('body-parser') From 862c13a89a86d88587539aebbfc90ede2bab51ae Mon Sep 17 00:00:00 2001 From: rochdev Date: Mon, 16 Sep 2024 19:13:52 -0400 Subject: [PATCH 25/26] use real tags --- test/crashtracker/app.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/crashtracker/app.js b/test/crashtracker/app.js index 4d4b0eb..5c5e971 100644 --- a/test/crashtracker/app.js +++ b/test/crashtracker/app.js @@ -26,8 +26,15 @@ crashtracker.initWithReceiver({ }, { library_name: 'dd-trace-js', library_version: '6.0.0-pre', - family: 'nodejs', - tags: ['foo:bar', 'baz:qux'] + family: 'javascript', + tags: [ + 'language:javascript', + 'runtime:nodejs', + 'runtime-id:8a8fef6433a849b3bc3171198831d102', + 'library_version:6.0.0-pre', + 'is_crash:true', + 'severity:crash' + ] }) require('./index.node').boom() From b6d3644e6d022ac2bdc08700122cfe5891daf5c0 Mon Sep 17 00:00:00 2001 From: rochdev Date: Tue, 17 Sep 2024 16:17:26 -0400 Subject: [PATCH 26/26] chmod binary instead of copy --- .github/workflows/release.yml | 1 + crates/crashtracker/src/lib.rs | 27 +-------------------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8139126..a581c8f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,6 +31,7 @@ jobs: - uses: actions/setup-node@v4 with: registry-url: 'https://registry.npmjs.org' + - run: chmod -R +x ./prebuilds - run: npm publish - id: pkg run: | diff --git a/crates/crashtracker/src/lib.rs b/crates/crashtracker/src/lib.rs index f4ed846..afb0726 100644 --- a/crates/crashtracker/src/lib.rs +++ b/crates/crashtracker/src/lib.rs @@ -1,19 +1,12 @@ -use datadog_crashtracker::CrashtrackerReceiverConfig; use napi::{Env, JsUnknown}; use napi_derive::napi; -use std::{env::temp_dir, fs, path::{self}}; - -#[cfg(unix)] -use std::os::unix::fs::PermissionsExt; #[napi] pub fn init_with_receiver(env: Env, config: JsUnknown, receiver_config: JsUnknown, metadata: JsUnknown) -> napi::Result<()> { let config = env.from_js_value(config)?; - let mut receiver_config = env.from_js_value(receiver_config)?; + let receiver_config = env.from_js_value(receiver_config)?; let metadata = env.from_js_value(metadata)?; - copy_receiver(&mut receiver_config).unwrap(); - datadog_crashtracker::init_with_receiver(config, receiver_config, metadata).unwrap(); Ok(()) @@ -36,21 +29,3 @@ pub fn update_metadata (env: Env, metadata: JsUnknown) -> napi::Result<()> { Ok(()) } - -pub fn copy_receiver (receiver_config: &mut CrashtrackerReceiverConfig) -> Result<(), anyhow::Error> { - let parts: Vec<_> = receiver_config.path_to_receiver_binary.rsplit(path::MAIN_SEPARATOR).collect(); - let dest = temp_dir().join(parts[0]); - - std::fs::copy(&receiver_config.path_to_receiver_binary, &dest)?; - - let mut perms = fs::metadata(&dest)?.permissions(); - - #[cfg(unix)] - perms.set_mode(0o777); - - fs::set_permissions(&dest, perms)?; - - receiver_config.path_to_receiver_binary = dest.to_string_lossy().to_string(); - - Ok(()) -}