Rest API provider crashes Web on failure
Closed this issue · 0 comments
jimlambie commented
Version: develop
To reproduce, add a twitter api with these details:
config:
"twitter": {
"type": "restapi",
"provider": "twitter",
"auth": {
"oauth": {
"consumer_key": "",
"consumer_secret": "",
"token": "",
"token_secret": ""
}
}
}
datasource:
{
"datasource": {
"key": "tweets",
"source": {
"api": "twitter",
"endpoint": "statuses/user_timeline"
},
"query": {
"screen_name": "dadi",
"exclude_replies": true,
"tweet_mode": "extended"
},
"count": 4
}
}
Returned from API:
body: { errors: [ [Object] ] } } { errors: [ { code: 215, message: 'Bad Authentication data.' } ] }
Web crashes with:
TypeError: "string" must be a string, Buffer, or ArrayBuffer
at Function.byteLength (buffer.js:481:11)
at purest.select.where.request (/web/node_modules/@dadi/web/dadi/lib/providers/restapi.js:107:46)