无法在shopify react应用程序中注册已卸载的Web钩子

问题描述 投票:0回答:1

//当我尝试注册已卸载的应用程序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]
}
]
}
reactjs next.js shopify-app
1个回答
0
投票
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);
  }
© www.soinside.com 2019 - 2024. All rights reserved.