From eefb9fa1cc5fc6e1cc166ec1f66747ed45d50cd7 Mon Sep 17 00:00:00 2001 From: Jiri Kozel Date: Mon, 4 Dec 2023 14:38:26 +0100 Subject: [PATCH] Improve logging in Layman Test Client related to Passport.js --- CHANGELOG.md | 1 + client/docker/Dockerfile.production | 6 +++++- client/docker/passport-oauth2-patch.diff | 12 ++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 client/docker/passport-oauth2-patch.diff diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bc998960..7daf7ef2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ #### Schema migrations #### Data migrations ### Changes +- Improve logging in Layman Test Client related to Passport.js. ## v1.22.2 diff --git a/client/docker/Dockerfile.production b/client/docker/Dockerfile.production index 8d0f82a54..3054ba7e9 100644 --- a/client/docker/Dockerfile.production +++ b/client/docker/Dockerfile.production @@ -3,7 +3,7 @@ FROM node:18-alpine RUN mkdir /code WORKDIR /code -RUN apk update && apk add wget +RUN apk update && apk add wget patch ARG LAYMAN_CLIENT_VERSION # https://stackoverflow.com/a/42144033 @@ -15,6 +15,10 @@ RUN wget "https://github.com/LayerManager/layman-test-client/archive/$LAYMAN_CLI RUN npm ci +COPY docker/passport-oauth2-patch.diff /code/ +RUN patch node_modules/passport-oauth2/lib/strategy.js < passport-oauth2-patch.diff +RUN rm passport-oauth2-patch.diff + ARG LTC_BASEPATH RUN test -n "LTC_BASEPATH" ENV LTC_BASEPATH=$LTC_BASEPATH diff --git a/client/docker/passport-oauth2-patch.diff b/client/docker/passport-oauth2-patch.diff new file mode 100644 index 000000000..24cffa4d4 --- /dev/null +++ b/client/docker/passport-oauth2-patch.diff @@ -0,0 +1,12 @@ +@@ -174,7 +174,10 @@ + + self._oauth2.getOAuthAccessToken(code, params, + function(err, accessToken, refreshToken, params) { +- if (err) { return self.error(self._createOAuthError('Failed to obtain access token', err)); } ++ if (err) { ++ console.warn("Failed to obtain access token: ", err); ++ return self.error(self._createOAuthError('Failed to obtain access token', err)); ++ } + if (!accessToken) { return self.error(new Error('Failed to obtain access token')); } + + self._loadUserProfile(accessToken, function(err, profile) {