sequence icon indicating copy to clipboard operation
sequence copied to clipboard

Webpack minification altering audience builder query

Open helsont opened this issue 4 years ago • 0 comments

On the executeAudience mutation there's an error with the SQL query being altered depending on if webpack is minifying the code or not.

With webpack.optimization.minimize = false:

Executing (default): SELECT "ProductUser"."id", "ProductUser"."intercomId", "ProductUser"."externalId", "ProductUser"."firstName", "ProductUser"."lastName", "ProductUser"."email", "ProductUser"."photo", "ProductUser"."phone", "ProductUser"."signedUpAt", "ProductUser"."lastSeenAt", "ProductUser"."browser", "ProductUser"."browserVersion", "ProductUser"."browserLanguage", "ProductUser"."os", "ProductUser"."country", "ProductUser"."region", "ProductUser"."city", "ProductUser"."title", "ProductUser"."websiteUrl", "ProductUser"."companyName", "ProductUser"."industry", "ProductUser"."traits", "ProductUser"."context", "ProductUser"."userId", "ProductUser"."createdAt", "ProductUser"."updatedAt", "ProductUser"."deletedAt" FROM "product_users" AS "ProductUser" LEFT OUTER JOIN "events" AS "events" ON "ProductUser"."externalId" = "events"."personId" AND ("events"."deletedAt" IS NULL) WHERE ("ProductUser"."deletedAt" IS NULL AND ("events"."name" = 'Push Notification Bounced' AND "events"."userId" = 'b318f47a-692b-4931-b1cc-f7d6a808598a' AND "ProductUser"."userId" = 'b318f47a-692b-4931-b1cc-f7d6a808598a')) GROUP BY "ProductUser"."id";

With webpack.optimization.minimize = true:

SELECT "c"."id", "c"."intercomId", "c"."externalId", "c"."firstName", "c"."lastName", "c"."email", "c"."photo", "c"."phone", "c"."signedUpAt", "c"."lastSeenAt", "c"."browser", "c"."browserVersion", "c"."browserLanguage", "c"."os", "c"."country", "c"."region", "c"."city", "c"."title", "c"."websiteUrl", "c"."companyName", "c"."industry", "c"."traits", "c"."context", "c"."userId", "c"."createdAt", "c"."updatedAt", "c"."deletedAt" FROM "product_users" AS "c" LEFT OUTER JOIN "events" AS "events" ON "c"."externalId" = "events"."personId" AND ("events"."deletedAt" IS NULL) WHERE ("c"."deletedAt" IS NULL AND ("events"."name" = 'Push Notification Bounced' AND "events"."userId" = 'b318f47a-692b-4931-b1cc-f7d6a808598a' AND "c"."userId" = 'b318f47a-692b-4931-b1cc-f7d6a808598a')) GROUP BY "ProductUser"."id";

This breaks the query because the GROUP BY key no longer matches a column name.

For now I'm going to leave minification as false, but I'm not sure why this is happening.

helsont avatar Jun 13 '21 16:06 helsont