chore(npm): add launch:check script
All checks were successful
Build and Push to Registry / build-and-push (push) Successful in 52s

This commit is contained in:
NicolasCantu 2025-09-24 18:24:36 +02:00
parent 8283185022
commit 0069d53946
3 changed files with 265 additions and 1 deletions

View File

@ -708,3 +708,223 @@ Full error response: {
statusCode: 404 statusCode: 404
} }
} }
❌ [ERROR] 2025-09-24T16:08:53.751Z HTTP GET / - 404
────────────────────────────────────────────────────────────────────────────────
{
duration: 5,
request: {
ip: '::ffff:45.135.193.100',
method: 'GET',
url: '/',
userAgent: undefined
},
requestId: 'req_1758730133743_33hw2gjyt',
response: {
statusCode: 404
}
}
❌ [ERROR] 2025-09-24T16:10:45.200Z HTTP GET / - 404
────────────────────────────────────────────────────────────────────────────────
{
duration: 1,
request: {
ip: '::ffff:159.65.20.49',
method: 'GET',
url: '/',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'
},
requestId: 'req_1758730245199_01y0lg4q2',
response: {
statusCode: 404
}
}
❌ [ERROR] 2025-09-24T16:10:45.282Z HTTP GET /download/powershell/ - 404
────────────────────────────────────────────────────────────────────────────────
{
duration: 0,
request: {
ip: '::ffff:159.65.20.49',
method: 'GET',
url: '/download/powershell/',
userAgent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'
},
requestId: 'req_1758730245281_qipi9aix8',
response: {
statusCode: 404
}
}
❌ [ERROR] 2025-09-24T16:10:45.359Z HTTP GET /get.php - 404
────────────────────────────────────────────────────────────────────────────────
{
duration: 0,
request: {
ip: '::ffff:159.65.20.49',
method: 'GET',
url: '/get.php',
userAgent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'
},
requestId: 'req_1758730245359_wc57j6ndv',
response: {
statusCode: 404
}
}
[IdNotCallback] incoming request {
originalUrl: '/idnot/callback?code=eyzP3g1U9rR_eU8posVgD-XrJHNyhgcf7Act7o2BLu3NDffTMYHDf8PnhBa87X1DpVlZiFfpAUZ5sDe0O1wwsLYYJqZG03XR6iy-FUvVRBq4_TBxteN6QlMNBrGZa8PIPLDduSgvTNd9co_9PG2NhvYk5ZDSZcaFVzSWC2IRYZNzKPnOfWd1NMr9aFK62xfpYnzMSER879r-IVOVR92hjXF63MA-TuuxQOO9WQgQ9gRrauQlJTrYIvnnjtoTd3hUjXiaK4wvlRyNNqYSkQXjdF2k4fanB9H4k8ioeQ3i6WcfPYiAoS4bP_DGhDOX4ed_Oso7XTk8RjymKAHVf-mR-of2n-WWQW0jAJFMlaJSFvSgm0KGZvsJcJX_oVQEiZ38dpiEJyVPiGV7WYzOH9Y35gzIl3CcFhAaIz9bqkpHLmZvNKQD_Q5NyaVa-WBoijrIltXfssA016g4qi6q4owykra7hOhH5URlk8_wfpR-jwe80NKZ55vPB0vhso-PWZ07aqc1oHVNpnN2dJGZSQJLm8nTTgEcDlFA7PewIXIg6eWHwUkZmJVLeU6hpAnlfgtUARoCczFcpktRLGzfY2XW-NHec1aIL0VC-7I0giWZtxY',
method: 'GET',
query: {
code_present: true,
code_length: 619,
state_present: false,
state_length: undefined
},
headers: {
host: 'dev3.4nkweb.com',
'x-forwarded-for': '212.133.41.15',
'x-forwarded-proto': 'https'
}
}
❌ [ERROR] 2025-09-24T16:15:36.750Z Application error occurred
────────────────────────────────────────────────────────────────────────────────
{
error: {
code: 'VALIDATION_ERROR',
details: [
{
constraints: [
'required'
],
field: 'code',
value: 'eyzP3g1U9rR_eU8posVgD-XrJHNyhgcf7Act7o2BLu3NDffTMYHDf8PnhBa87X1DpVlZiFfpAUZ5sDe0O1wwsLYYJqZG03XR6iy-FUvVRBq4_TBxteN6QlMNBrGZa8PIPLDduSgvTNd9co_9PG2NhvYk5ZDSZcaFVzSWC2IRYZNzKPnOfWd1NMr9aFK62xfpYnzMSER8'... 419 more characters
},
{
constraints: [
'required'
],
field: 'state',
value: undefined
}
],
message: 'Missing code or state',
stack: 'Error: Missing code or state\n' +
' at new ValidationError (/home/ank/dev/lecoffre-back-mini/dist/types/errors.js:64:9)\n' +
' at /home/ank/dev/lecoffre-back-mini/dist/handlers/idnot-callback.handlers.js:39'... 1445 more characters,
statusCode: 400
},
request: {
ip: '::ffff:127.0.0.1',
method: 'GET',
url: '/idnot/callback?code=eyzP3g1U9rR_eU8posVgD-XrJHNyhgcf7Act7o2BLu3NDffTMYHDf8PnhBa87X1DpVlZiFfpAUZ5sDe0O1wwsLYYJqZG03XR6iy-FUvVRBq4_TBxteN6QlMNBrGZa8PIPLDduSgvTNd9co_9PG2NhvYk5ZDSZcaFVzSWC2IRYZNzKPnOfWd'... 440 more characters,
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36'
},
requestId: 'req_1758730536740_2hi0hct8u'
}
❌ [ERROR] 2025-09-24T16:15:36.757Z HTTP GET /idnot/callback?code=eyzP3g1U9rR_eU8posVgD-XrJHNyhgcf7Act7o2BLu3NDffTMYHDf8PnhBa87X1DpVlZiFfpAUZ5sDe0O1wwsLYYJqZG03XR6iy-FUvVRBq4_TBxteN6QlMNBrGZa8PIPLDduSgvTNd9co_9PG2NhvYk5ZDSZcaFVzSWC2IRYZNzKPnOfWd1NMr9aFK62xfpYnzMSER879r-IVOVR92hjXF63MA-TuuxQOO9WQgQ9gRrauQlJTrYIvnnjtoTd3hUjXiaK4wvlRyNNqYSkQXjdF2k4fanB9H4k8ioeQ3i6WcfPYiAoS4bP_DGhDOX4ed_Oso7XTk8RjymKAHVf-mR-of2n-WWQW0jAJFMlaJSFvSgm0KGZvsJcJX_oVQEiZ38dpiEJyVPiGV7WYzOH9Y35gzIl3CcFhAaIz9bqkpHLmZvNKQD_Q5NyaVa-WBoijrIltXfssA016g4qi6q4owykra7hOhH5URlk8_wfpR-jwe80NKZ55vPB0vhso-PWZ07aqc1oHVNpnN2dJGZSQJLm8nTTgEcDlFA7PewIXIg6eWHwUkZmJVLeU6hpAnlfgtUARoCczFcpktRLGzfY2XW-NHec1aIL0VC-7I0giWZtxY - 400
────────────────────────────────────────────────────────────────────────────────
{
duration: 17,
request: {
ip: '::ffff:127.0.0.1',
method: 'GET',
url: '/idnot/callback?code=eyzP3g1U9rR_eU8posVgD-XrJHNyhgcf7Act7o2BLu3NDffTMYHDf8PnhBa87X1DpVlZiFfpAUZ5sDe0O1wwsLYYJqZG03XR6iy-FUvVRBq4_TBxteN6QlMNBrGZa8PIPLDduSgvTNd9co_9PG2NhvYk5ZDSZcaFVzSWC2IRYZNzKPnOfWd'... 440 more characters,
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36'
},
requestId: 'req_1758730536740_2hi0hct8u',
response: {
statusCode: 400
}
}
[IdNotCallback] incoming request {
originalUrl: '/idnot/callback',
method: 'GET',
query: {
code_present: false,
code_length: undefined,
state_present: false,
state_length: undefined
},
headers: {
host: 'dev3.4nkweb.com',
'x-forwarded-for': '212.133.41.15',
'x-forwarded-proto': 'https'
}
}
❌ [ERROR] 2025-09-24T16:15:40.294Z Application error occurred
────────────────────────────────────────────────────────────────────────────────
{
error: {
code: 'VALIDATION_ERROR',
details: [
{
constraints: [
'required'
],
field: 'code',
value: undefined
},
{
constraints: [
'required'
],
field: 'state',
value: undefined
}
],
message: 'Missing code or state',
stack: 'Error: Missing code or state\n' +
' at new ValidationError (/home/ank/dev/lecoffre-back-mini/dist/types/errors.js:64:9)\n' +
' at /home/ank/dev/lecoffre-back-mini/dist/handlers/idnot-callback.handlers.js:39'... 1445 more characters,
statusCode: 400
},
request: {
ip: '::ffff:127.0.0.1',
method: 'GET',
url: '/idnot/callback',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36'
},
requestId: 'req_1758730540293_zfsqodog5'
}
❌ [ERROR] 2025-09-24T16:15:40.296Z HTTP GET /idnot/callback - 400
────────────────────────────────────────────────────────────────────────────────
{
duration: 3,
request: {
ip: '::ffff:127.0.0.1',
method: 'GET',
url: '/idnot/callback',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36'
},
requestId: 'req_1758730540293_zfsqodog5',
response: {
statusCode: 400
}
}
❌ [ERROR] 2025-09-24T16:22:16.993Z HTTP GET / - 404
────────────────────────────────────────────────────────────────────────────────
{
duration: 6,
request: {
ip: '::ffff:204.76.203.219',
method: 'GET',
url: '/',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46'
},
requestId: 'req_1758730936984_72x2zwh0m',
response: {
statusCode: 404
}
}
[INFO] 2025-09-24T16:22:42.682Z HTTP POST /api/v1/idnot/state - 200
────────────────────────────────────────────────────────────────────────────────
{
duration: 21,
request: {
ip: '::ffff:127.0.0.1',
method: 'POST',
url: '/api/v1/idnot/state',
userAgent: 'curl/8.14.1'
},
requestId: 'req_1758730962656_wlye8imhw',
response: {
statusCode: 200
}
}

View File

@ -11,7 +11,8 @@
"dev:js": "nodemon src/server.js", "dev:js": "nodemon src/server.js",
"test:db": "npm run build && node test-db-init.js", "test:db": "npm run build && node test-db-init.js",
"test:rattachements": "node test-rattachements-endpoint.js", "test:rattachements": "node test-rattachements-endpoint.js",
"test:quick": "node quick-test-rattachements.js" "test:quick": "node quick-test-rattachements.js",
"launch:check": "bash scripts/launch_check.sh"
}, },
"dependencies": { "dependencies": {
"@mailchimp/mailchimp_transactional": "^1.0.59", "@mailchimp/mailchimp_transactional": "^1.0.59",

43
scripts/launch_check.sh Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -euo pipefail
echo "[1/6] Backing up nginx confs..."
./scripts/backup_nginx_confs.sh
echo "[2/6] Checking required environment variables..."
REQUIRED=("PORT" "APP_HOST" "DEFAULT_STORAGE" "SIGNER_WS_URL" "SIGNER_API_KEY")
MISSING=()
for v in "${REQUIRED[@]}"; do
if [ -z "${!v:-}" ]; then MISSING+=("$v"); fi
done
if [ ${#MISSING[@]} -gt 0 ]; then
echo "Missing env vars: ${MISSING[*]}" >&2; exit 1; fi
echo "[3/6] Building backend..."
npm run build --silent
echo "[4/6] Starting backend (detached) if not already running..."
if ! nc -z localhost "${PORT}" >/dev/null 2>&1; then
nohup node dist/server.js > logs/backend.out 2>&1 &
echo $! > logs/server.pid
sleep 2
fi
if ! nc -z localhost "${PORT}" >/dev/null 2>&1; then echo "Backend not listening on ${PORT}" >&2; exit 1; fi
echo "[5/6] Curl checks - backend health and key routes..."
set +e
curl -fsS "http://localhost:${PORT}/api/v1/health" | jq . >/dev/null && echo "OK /api/v1/health" || { echo "FAIL /api/v1/health"; exit 1; }
curl -fsS -X OPTIONS -H "Origin: ${APP_HOST}" "http://localhost:${PORT}/api/v1/health" -o /dev/null && echo "OK CORS preflight" || { echo "FAIL CORS"; exit 1; }
set -e
echo "[6/6] External service checks..."
echo "- Checking mempool signet..."
curl -fsS "https://mempool2.4nkweb.com/fr/docs/api/rest" -o /dev/null && echo "OK mempool" || echo "WARN mempool unreachable"
echo "- Checking signer relay ws..."
if command -v wscat >/dev/null 2>&1; then
( timeout 3 wscat -c "${SIGNER_WS_URL/ws:/wss:}" >/dev/null 2>&1 && echo "OK signer ws connect" ) || echo "WARN signer ws connect failed"
else
echo "wscat not installed; skipping ws check"
fi
echo "All checks done."