Closed f1rstsurf closed 3 years ago
It does not seem to be an issue in shopify-api-node
. The error is thrown when you write the HTTP response from express. It seems that the article data is used as the status code for HTTP response instead of the body. You should investigate why this happens. Are you calling the express response.send()
method with two arguments?
Hi, thank you for your help, here is my http response code handling :
app.post('/createArticle', (req, res) => {
shopify.createArticle(req.body.postApiKey, req.body.postApiPass, req.body.postApiSite,req.body.postArticleContent, req.body.postBlogName, function(error, data) {
if (error) {
//If an issue occured let's display it
console.log(error);
res.end(error, null);
} else {
//console.log(data);
res.sendStatus(data);
}
});
});
I've got about 30 function with the same structure (createproduct, getCollections ...etc), and it's the first time I'm facing this issue. I'll take a closer look to my code, as it does not seems to be related with shopify-api-node.
Thank you
res.sendStatus(data);
Check that data
here is a valid status code and not the article data.
I just rechecked today, everything is working well now, maybe a Shopify side issue ?
Hi,
I'm facing a strange issue while creating a new article for my blog :
This issue occurs when I'm returning the datas into the callback :
What is pretty weird, is that the article is successfully created, and the promise does return correct data (See attached screen).
Also, I'm using the latest Webhook API version (2021-01).
Do you have any idea ?