adunkman / dc311rn.com

Quickly check the status of a DC 311 service request
https://www.dc311rn.com
MIT License
6 stars 0 forks source link

Fix scoping issue in Twitter worker. #32

Closed adunkman closed 6 years ago

adunkman commented 6 years ago

The Twitter worker has not been able to fetch service requests since #30 because of a scoping issue (that PR introduced this.getJson inside of DC311.getServiceRequest) — I really need to get around to writing more tests!

Relevant log entry. ```json { "name": "Twitter Worker", "hostname": "814d2c36-deed-4fe2-90b8-3e70efc1943f", "pid": 20, "level": 40, "err": { "message": "Cannot read property 'getJson' of undefined", "name": "TypeError", "stack": "TypeError: Cannot read property 'getJson' of undefined\n at _callee$ (/app/dist/api/dc311.js:119:29)\n at tryCatch (/app/node_modules/regenerator-runtime/runtime.js:62:40)\n at Generator.invoke [as _invoke] (/app/node_modules/regenerator-runtime/runtime.js:296:22)\n at Generator.prototype.(anonymous function) [as next] (/app/node_modules/regenerator-runtime/runtime.js:114:21)\n at step (/app/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)\n at /app/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14\n at new Promise ()\n at new F (/app/node_modules/core-js/library/modules/_export.js:36:28)\n at /app/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12\n at getServiceRequest (/app/dist/api/dc311.js:152:22)" }, "tweet": { "attributes": { "created_at": "Wed Aug 08 18:01:17 +0000 2018", "id": 1027253429759082500, "id_str": "1027253429759082497", "full_text": "@DDOTDC @pmod Good afternoon. We have submitted service request number 1800429616 for this matter. Thank you.", "truncated": false, "display_text_range": [ 14, 111 ], "entities": { "hashtags": [], "symbols": [], "user_mentions": [ { "screen_name": "DDOTDC", "name": "DDOT DC", "id": 21789369, "id_str": "21789369", "indices": [ 0, 7 ] }, { "screen_name": "pmod", "name": "Peter M. O’Donnell", "id": 2233601, "id_str": "2233601", "indices": [ 8, 13 ] } ], "urls": [] }, "metadata": { "iso_language_code": "en", "result_type": "recent" }, "source": "Hootsuite Inc.", "in_reply_to_status_id": 1027250529980870700, "in_reply_to_status_id_str": "1027250529980870656", "in_reply_to_user_id": 21789369, "in_reply_to_user_id_str": "21789369", "in_reply_to_screen_name": "DDOTDC", "user": { "id": 309045688, "id_str": "309045688", "name": "DC311 (32311)", "screen_name": "311DCgov", "location": "Washington, D.C.", "description": "DC 311 is here for you! Providing city services and information 24/7 365 days a year. Dial 911 for Emergency response from MPD or DC Fire and EMS.", "url": "http://t.co/qNhbWWW1ji", "entities": { "url": { "urls": [ { "url": "http://t.co/qNhbWWW1ji", "expanded_url": "http://ouc.dc.gov", "display_url": "ouc.dc.gov", "indices": [ 0, 22 ] } ] }, "description": { "urls": [] } }, "protected": false, "followers_count": 11120, "friends_count": 478, "listed_count": 341, "created_at": "Wed Jun 01 12:55:00 +0000 2011", "favourites_count": 1514, "utc_offset": null, "time_zone": null, "geo_enabled": true, "verified": true, "statuses_count": 17158, "lang": "en", "contributors_enabled": false, "is_translator": false, "is_translation_enabled": false, "profile_background_color": "FFFFFF", "profile_background_image_url": "http://abs.twimg.com/images/themes/theme16/bg.gif", "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme16/bg.gif", "profile_background_tile": true, "profile_image_url": "http://pbs.twimg.com/profile_images/794322386007060480/q5JDiAcK_normal.jpg", "profile_image_url_https": "https://pbs.twimg.com/profile_images/794322386007060480/q5JDiAcK_normal.jpg", "profile_banner_url": "https://pbs.twimg.com/profile_banners/309045688/1501686286", "profile_link_color": "B30000", "profile_sidebar_border_color": "000000", "profile_sidebar_fill_color": "DDFFCC", "profile_text_color": "333333", "profile_use_background_image": true, "has_extended_profile": false, "default_profile": false, "default_profile_image": false, "following": null, "follow_request_sent": null, "notifications": null, "translator_type": "none" }, "geo": null, "coordinates": null, "place": null, "contributors": null, "is_quote_status": false, "retweet_count": 0, "favorite_count": 0, "favorited": false, "retweeted": false, "lang": "en" } }, "msg": "Could not fetch service requests from 311 for tweet.", "time": "2018-08-08T18:01:38.107Z", "v": 0 } ```