Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stringifying session ID for airship #3896

Merged
merged 10 commits into from
Nov 21, 2024
5 changes: 4 additions & 1 deletion src/v0/destinations/airship/data/airshipTrackConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
{
"destKey": "session_id",
"sourceKeys": ["properties.sessionId", "context.sessionId"],
"required": false
"required": false,
"metadata": {
"type": "toString"
}
},
{
"destKey": "transaction",
Expand Down
263 changes: 262 additions & 1 deletion test/integrations/destinations/airship/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2296,7 +2296,7 @@ export const data = [
},
{
name: 'airship',
description: 'Test 22 : session id gets converted to v5 uuid format',
description: 'Test 22 : session id from Web SDK gets converted to v5 uuid format',
feature: 'processor',
module: 'destination',
version: 'v0',
Expand Down Expand Up @@ -2381,6 +2381,267 @@ export const data = [
},
},
},
{
name: 'airship',
description: 'Test 23 : session id from mobile SDK gets converted to v5 uuid format',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
message: {
channel: 'web',
context: {
app: {
build: '1.0.0',
name: 'RudderLabs JavaScript SDK',
namespace: 'com.rudderlabs.javascript',
version: '1.0.0',
},
traits: { email: '[email protected]', firstName: 'test', lastName: 'one' },
library: { name: 'RudderLabs JavaScript SDK', version: '1.0.0' },
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
locale: 'en-US',
ip: '0.0.0.0',
os: { name: '', version: '' },
screen: { density: 2 },
sessionId: 1731403898,
},
type: 'track',
messageId: '84e26acc-56a5-4835-8233-591137fca468',
anonymousId: '123456',
event: 'Product Clicked',
userId: 'testuserId1',
properties: {},
integrations: { All: true },
},
destination: {
Config: {
apiKey: 'dummyApiKey',
appKey: 'ffdf',
dataCenter: false,
},
},
},
],
method: 'POST',
},
},
output: {
response: {
status: 200,
body: [
{
output: {
version: '1',
type: 'REST',
method: 'POST',
endpoint: 'https://go.urbanairship.com/api/custom-events',
headers: {
'Content-Type': 'application/json',
Accept: 'application/vnd.urbanairship+json; version=3',
'X-UA-Appkey': 'ffdf',
Authorization: 'Bearer dummyApiKey',
},
params: {},
body: {
JSON: {
user: { named_user_id: 'testuserId1' },
body: {
name: 'product_clicked',
session_id: 'd5627eac-795d-5005-9bb4-2c7c0af6cab0',
},
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
userId: '',
},
statusCode: 200,
},
],
},
},
},
{
name: 'airship',
description: 'Test 24 : session id null gets ignored',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
message: {
channel: 'web',
context: {
app: {
build: '1.0.0',
name: 'RudderLabs JavaScript SDK',
namespace: 'com.rudderlabs.javascript',
version: '1.0.0',
},
traits: { email: '[email protected]', firstName: 'test', lastName: 'one' },
library: { name: 'RudderLabs JavaScript SDK', version: '1.0.0' },
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
locale: 'en-US',
ip: '0.0.0.0',
os: { name: '', version: '' },
screen: { density: 2 },
},
type: 'track',
messageId: '84e26acc-56a5-4835-8233-591137fca468',
anonymousId: '123456',
event: 'Product Clicked',
userId: 'testuserId1',
properties: {
sessionId: null,
},
integrations: { All: true },
},
destination: {
Config: {
apiKey: 'dummyApiKey',
appKey: 'ffdf',
dataCenter: false,
},
},
},
],
method: 'POST',
},
},
output: {
response: {
status: 200,
body: [
{
output: {
version: '1',
type: 'REST',
method: 'POST',
endpoint: 'https://go.urbanairship.com/api/custom-events',
headers: {
'Content-Type': 'application/json',
Accept: 'application/vnd.urbanairship+json; version=3',
'X-UA-Appkey': 'ffdf',
Authorization: 'Bearer dummyApiKey',
},
params: {},
body: {
JSON: {
user: { named_user_id: 'testuserId1' },
body: {
name: 'product_clicked',
},
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
userId: '',
},
statusCode: 200,
},
],
},
},
},
{
name: 'airship',
description: 'Test 24 : session id undefined gets ignored',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
message: {
channel: 'web',
context: {
app: {
build: '1.0.0',
name: 'RudderLabs JavaScript SDK',
namespace: 'com.rudderlabs.javascript',
version: '1.0.0',
},
traits: { email: '[email protected]', firstName: 'test', lastName: 'one' },
library: { name: 'RudderLabs JavaScript SDK', version: '1.0.0' },
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
locale: 'en-US',
ip: '0.0.0.0',
os: { name: '', version: '' },
screen: { density: 2 },
},
type: 'track',
messageId: '84e26acc-56a5-4835-8233-591137fca468',
anonymousId: '123456',
event: 'Product Clicked',
userId: 'testuserId1',
properties: {
sessionId: undefined,
},
integrations: { All: true },
},
destination: {
Config: {
apiKey: 'dummyApiKey',
appKey: 'ffdf',
dataCenter: false,
},
},
},
],
method: 'POST',
},
},
output: {
response: {
status: 200,
body: [
{
output: {
version: '1',
type: 'REST',
method: 'POST',
endpoint: 'https://go.urbanairship.com/api/custom-events',
headers: {
'Content-Type': 'application/json',
Accept: 'application/vnd.urbanairship+json; version=3',
'X-UA-Appkey': 'ffdf',
Authorization: 'Bearer dummyApiKey',
},
params: {},
body: {
JSON: {
user: { named_user_id: 'testuserId1' },
body: {
name: 'product_clicked',
},
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
userId: '',
},
statusCode: 200,
},
],
},
},
},
].map((tc) => ({
...tc,
mockFns: (_) => {
Expand Down
Loading