Skip to content

Commit b80e57f

Browse files
authored
Merge pull request #6282 from Shopify/08-19-webhook_subscriptions_shouldnt_block_dev
Webhook subscriptions shouldnt block dev
2 parents 67841cb + 42ad5af commit b80e57f

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

packages/app/src/cli/services/dev.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,31 @@ describe('blockIfMigrationIncomplete', () => {
108108
await expect(blockIfMigrationIncomplete(devConfig)).resolves.toBeUndefined()
109109
})
110110

111+
test('does nothing remote extensions dont have uids but are webhook subscriptions', async () => {
112+
const developerPlatformClient = testDeveloperPlatformClient({
113+
supportsDevSessions: true,
114+
async appExtensionRegistrations() {
115+
return {
116+
app: {
117+
extensionRegistrations: [
118+
{id: '', uuid: 'u1', title: 'Ext 1', type: 'webhook_subscription'},
119+
{id: '2', uuid: 'u2', title: 'Ext 2', type: 'web_pixel_extension'},
120+
],
121+
configurationRegistrations: [],
122+
dashboardManagedExtensionRegistrations: [],
123+
},
124+
} as any
125+
},
126+
})
127+
128+
const devConfig = {
129+
...baseConfig(),
130+
developerPlatformClient,
131+
} as any
132+
133+
await expect(blockIfMigrationIncomplete(devConfig)).resolves.toBeUndefined()
134+
})
135+
111136
test('throws AbortError when some remote extensions are missing ids (not migrated)', async () => {
112137
const developerPlatformClient = testDeveloperPlatformClient({
113138
supportsDevSessions: true,

packages/app/src/cli/services/dev.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,12 @@ export async function blockIfMigrationIncomplete(devConfig: DevConfig) {
242242
if (!developerPlatformClient.supportsDevSessions) return
243243

244244
const extensions = (await developerPlatformClient.appExtensionRegistrations(remoteApp)).app.extensionRegistrations
245-
if (!extensions.every((extension) => extension.id)) {
245+
if (
246+
!extensions
247+
// Ignore webhook subscriptions because they do need UIDs but shouldn't block dev
248+
.filter((extension) => extension.type.toLowerCase() !== 'webhook_subscription')
249+
.every((extension) => extension.id)
250+
) {
246251
const message = ['Your app has extensions which need to be assigned', {command: 'uid'}, 'identifiers.']
247252
const nextSteps = [
248253
'You must first map IDs to your existing extensions by running',

0 commit comments

Comments
 (0)