Open
Description
@WebhookHandler('BULK_OPERATIONS_FINISH')
export class BulkOperationsWebhookHandler extends ShopifyWebhookHandler<unknown> {
private readonly logger = new Logger('BULK_OPERATIONS_FINISH');
constructor(
@InjectRepository(ShopEntity) private readonly shopRepo: ShopRepository
) {
super();
}
async handle(
domain: string,
data: unknown,
webhookId: string
): Promise<void> {
const shop = await this.shopRepo.findOneOrFail({ domain });
this.logger.log(`Webhook ${webhookId} called for shop ID ${shop}`);
this.logger.log(data);
}
}
basically a copy of ProductsCreateWebhookHandler
I also added it to the webhook.module.ts
import { MikroOrmModule } from '@mikro-orm/nestjs';
import { ShopifyWebhooksModule } from '@nestjs-shopify/webhooks';
import { Module } from '@nestjs/common';
import { ShopEntity } from '../../shops/shop.entity';
import { ProductsCreateWebhookHandler } from './handlers/products-create.webhook-handler';
import { BulkOperationsWebhookHandler } from './handlers/bulk-operations.webhook-handler';
@Module({
imports: [
MikroOrmModule.forFeature([ShopEntity]),
ShopifyWebhooksModule.forRoot({
path: '/shopify/webhooks',
}),
],
providers: [ProductsCreateWebhookHandler, BulkOperationsWebhookHandler],
})
export class WebhooksModule {}
When I submitted through shopifies test GraphQL tool, nothing happened,
mutation {
bulkOperationRunQuery(
query: """
{
products {
edges {
node {
id
title
}
}
}
}
"""
) {
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}
I expected after some point to get a websocket event kick off, but nothing ever happened. Is this due to latency in websockets? or did I do something wrong?
Metadata
Metadata
Assignees
Labels
No labels