dadi / web

Web is a drop in front end for websites and web apps. Consumes data from DADI API and others
https://dadi.cloud/en/web/
Other
48 stars 16 forks source link

Rest API provider crashes Web on failure #383

Closed jimlambie closed 6 years ago

jimlambie commented 6 years ago

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)