//当我尝试注册已卸载的应用程序webhook时,出现以下错误是我的代码来注册已卸载的webhook,而我正在创建的其他钩子也可以正常工作
const registrationUninstall = await registerWebhook({
address: `${HOST}/uninstalled`,
topic: 'app/uninstalled',
accessToken,
shop,
apiVersion: ApiVersion.October19
});
if (registrationUninstall.success) {
console.log('Successfully registered uninstall webhook!');
} else {
console.log('Failed to register uninstall webhook', registrationUninstall.result);
}
// This is the error i am getting while i am trying to register uninstalled app webhook:-
Failed to register uninstall webhook {
errors: [
{
message: 'Parse error on "/" (error) at [3, 44]',
locations: [Array]
}
]
}
If you are going to create shopify react app and want to register uninstall web-hooks all you need to give topic name with capital letters followed by underscore between keywords please refer below code for uninstall web hooks registration :-
// Uninstalled Web Hook :-
const registrationUninstall = await registerWebhook({
address: `${HOST}/webhooks/uninstalled_app`,
topic: 'APP_UNINSTALLED',
accessToken,
shop,
apiVersion: ApiVersion.October19
});
if (registrationUninstall.success) {
console.log('Successfully registered uninstall webhook!');
} else {
console.log('Failed to register uninstall webhook', registrationUninstall.result);
}