Closed caugner closed 4 years ago
Actually, yarn run test
doesn't pass locally either:
yarn run v1.5.1
$ node test.js
/home/mozilla/git/meetup-random-user/webtask/meetup-random-user.js:25
id: url.match(/\/(\d+)/)[1],
^
TypeError: Cannot read property 'match' of undefined
at Request._callback (/home/user/git/meetup-random-user/webtask/meetup-random-user.js:25:14)
at Request.self.callback (/home/user/git/meetup-random-user/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/home/user/git/meetup-random-user/node_modules/request/request.js:1163:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/home/user/git/meetup-random-user/node_modules/request/request.js:1085:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
error An unexpected error occurred: "Command failed.
Exit code: 1
The problem seems to be that the Meetup /attendees
endpoint does not return the user list directly, but rather loads it in a separate ajax request.
For example, the attendee list for the aforementioned meetup is fetched via https://www.meetup.com/mu_api/urlname/events/eventId/attendees?queries=(endpoint:Paris-js/events/244179664/attendance,meta:(method:get),params:(desc:!t,fields:'self,web_actions,answers,pay_status',order:time),ref:eventAttendance_Paris-js_244179664,type:attendance) (and requires a CSRF token).
Here's a workaround to pick a random meetup user in the browser (from the attendees list):
let users = document.querySelectorAll('.attendee-item');
let user = users[Math.floor(Math.random() * users.length)];
document.body.innerHTML = user.innerHTML;
To reproduce:
Pick one
.Request headers:
Response headers:
Response: