diff --git a/src/index.js b/src/index.js index eaef18e..940d383 100644 --- a/src/index.js +++ b/src/index.js @@ -36,7 +36,7 @@ export const main = async () => { origin: true, credentials: true, }); - + server.register(oauth, { name: 'googleOAuth2', scope: ['https://www.googleapis.com/auth/youtube.readonly', 'https://www.googleapis.com/auth/youtube.force-ssl', "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"], @@ -58,15 +58,11 @@ export const main = async () => { callbackUri: `${env.PUBLIC_API_URL}/auth/google/callback` }); - server.addContentTypeParser(['text/xml', 'application/xml', 'application/atom+xml'], { parseAs: 'string' }, async (request, payload, done) => { - try { - let parsed = await xml2js.parseStringPromise(payload); - done(null, parsed) - } catch(e) { - console.log(e); - done(e, undefined) - } - }) + server.addContentTypeParser(['text/xml', 'application/xml', 'application/atom+xml'], { parseAs: 'string' }, function (request, payload, done) { + xml2js.parseString(payload, function (err, body) { + done(err, body) + }) + }) // Routes server.register(channelRoutes, {