After yesterday, I’m no longer able to utilize my Twitch social connection. Rather than working normally, my callback endpoint is now receiving “Cannot read properties of undefined (reading ‘get’)” which indicates to me this is a javascript error. After reading into the topic, I found out that scripts and hooks could be possible culprits.
I have not created any custom scripts, but it seems that auth0 does that for you when creating a social connection. This is the relevant field for my connection, obtained from the Get Connections API endpoint. I have not made any changes to it, and this was obtained from a freshly created connection:
"function fetchUserProfile(accessToken, context, callback) {\n request.get({\n url: 'https://api.twitch.tv/helix/users',\n headers: {\n 'Authorization': `Bearer ${accessToken}`,\n 'Client-ID': context.options.client_id\n }\n },\n (err, resp, body) => {\n if (err) {\n return callback(err);\n }\n\n if (resp.statusCode !== 200) {\n return callback(new Error(`[Response code: ${resp.statusCode}] ${body}`));\n }\n let bodyParsed;\n try {\n let twitchData = JSON.parse(body);\n twitchData = twitchData.data[0];\n bodyParsed = {\n username: twitchData.display_name,\n user_id: twitchData.id,\n picture: twitchData.profile_image_url || '',\n email: twitchData.email || ''\n };\n } catch (jsonError) {\n return callback(new Error(body));\n }\n return callback(null, bodyParsed);\n });\n}"
As you can see, it’s pretty simple javascript (sorry for the horrendous formatting, but it’s what the API spat out). The issue is that the request
object is now returning undefined
. I have not made any changes on my side, so I can only suspect this is a breaking change coming from Auth0. If this request
object has been deprecated, then what should I be using instead? fetch
does not seem to be available either.