diff --git a/features/messaging/backend-api/scripts/plum-integration-test.sh b/features/messaging/backend-api/scripts/plum-integration-test.sh index dcf1163dd..94a91c917 100755 --- a/features/messaging/backend-api/scripts/plum-integration-test.sh +++ b/features/messaging/backend-api/scripts/plum-integration-test.sh @@ -261,11 +261,15 @@ if [[ "$DO_TEST" == true ]]; then # Step 4: Generate test JWT tokens print_step "Generating test JWT tokens..." + # Use valid UUIDs for user IDs (database columns are UUID type) + CREATOR_UUID="a1b2c3d4-e5f6-7890-abcd-ef1234567890" + CLIENT_UUID="b2c3d4e5-f6a7-8901-bcde-f12345678901" + TOKEN_CREATOR=$(plum "node -e \" const crypto = require('crypto'); function base64url(obj) { return Buffer.from(JSON.stringify(obj)).toString('base64url'); } const header = base64url({alg:'HS256',typ:'JWT'}); -const payload = base64url({sub:'test-creator-001',role:'creator',iat:Math.floor(Date.now()/1000),exp:Math.floor(Date.now()/1000)+86400}); +const payload = base64url({sub:'$CREATOR_UUID',role:'creator',iat:Math.floor(Date.now()/1000),exp:Math.floor(Date.now()/1000)+86400}); const sig = crypto.createHmac('sha256','$JWT_SECRET').update(header+'.'+payload).digest('base64url'); console.log(header+'.'+payload+'.'+sig); \"") @@ -274,7 +278,7 @@ console.log(header+'.'+payload+'.'+sig); const crypto = require('crypto'); function base64url(obj) { return Buffer.from(JSON.stringify(obj)).toString('base64url'); } const header = base64url({alg:'HS256',typ:'JWT'}); -const payload = base64url({sub:'test-client-001',role:'client',iat:Math.floor(Date.now()/1000),exp:Math.floor(Date.now()/1000)+86400}); +const payload = base64url({sub:'$CLIENT_UUID',role:'client',iat:Math.floor(Date.now()/1000),exp:Math.floor(Date.now()/1000)+86400}); const sig = crypto.createHmac('sha256','$JWT_SECRET').update(header+'.'+payload).digest('base64url'); console.log(header+'.'+payload+'.'+sig); \"") @@ -347,7 +351,7 @@ console.log(header+'.'+payload+'.'+sig); CREATE_THREAD_RESPONSE=$(plum "curl -sf -X POST http://localhost:3120/api/messaging/threads \ -H 'Authorization: Bearer $TOKEN_CREATOR' \ -H 'Content-Type: application/json' \ - -d '{\"creatorId\": \"test-creator-001\", \"clientId\": \"test-client-001\"}' 2>&1" || true) + -d '{\"creatorId\": \"$CREATOR_UUID\", \"clientId\": \"$CLIENT_UUID\"}' 2>&1" || true) THREAD_ID=$(echo "$CREATE_THREAD_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)