Open baraths84 opened 4 years ago
Hi @baraths84, I'm not entirely sure as there is not much logs from lambda itself you shared but I have some ideas what could go wrong.
The response error target_url must use http(s) scheme
might indicate a call from calling the Github API to set a status on a commit (github docs). Therefore, it could be a reason of not being able to get the repo supervisor (lambda) URL that it could be accessed from the internet.
This is the code that potentially failed: https://github.com/auth0/repo-supervisor/blob/6d3f0cec98177186b8a0ba75df2a1aac02bf7a12/src/helpers/url.js#L5-L13
If you are debugging that please check if event.headers.
is not empty.
Please verify:
repo:status
scope is assigned to your github personal access token. Otherwise, it's not possible to set CI statuses on a commit.GITHUB_TOKEN
, JWT_SECRET
Hi @radekk - Thanks for the inputs. I am still stuck on the same error. Verified (1,2,3) For 2 - I created the Environment variable GITHUB_TOKEN, JWT_SECRET on AWS Lambda function alone. -verified permissions.
i debugged and observed the payload flowing in
module.exports = async (payload, event, github, viewer, res, isFalsePositiveReport) => { console.log(payload.repository.name); console.log(event);
"event" is not empty - full json is logging correctly reference here.
const endpointURL = url.getEndpointURL(event);
- this returns empty.
Yes i see event.headers object is undefined/empty.
I am still getting the same error. HttpError: Validation Failed: {"resource":"Status","code":"custom","field":"target_url","message":"target_url must use http(s) scheme"}
AWS screenshots reference here
@baraths84 In the payload you included I see that there is x-forwarded-proto
instead of X-Forwarded-Proto
I use in the repo-supervisor. It might be an issue.
Would you be able to edit the source code and implement a change in a file: https://github.com/auth0/repo-supervisor/blob/6d3f0cec98177186b8a0ba75df2a1aac02bf7a12/src/helpers/url.js#L9
protocol: event.headers['X-Forwarded-Proto'],
protocol: event.headers['x-forwarded-proto'],
Then rebuild and repackage the repo-supervisor: npm run build
and upload a new zip package to lambda.
Let me know if this worked.
Hi @radekk , Thank you for debugging more!This helped fix the issue. Few other observations after applying the fix(sequence of fixes below):
1) Supervisor — SLACK_URL is not set
- I got this issue after applying the fix - Looks like this is mandatory ?
repo-supervisor/config/main.json - I updated below property to 'false' to disable the trigger like below
"runTriggers": false
to disable Slack reporting.
2) To fix broken link "details"- in PULL request - i updated the below "host" and "pathname" like below, since the payload was different. (is this because of github API revision changes ?) .
from
return url.format({ protocol: event.headers['x-forwarded-proto'], host: event.headers.Host, pathname: event.path }).replace(/\/+$/g, ''); },
to
return url.format({ protocol: event.headers['x-forwarded-proto'], host: event.headers.host, pathname: event.rawPath }).replace(/\/+$/g, '');
3) under - repo-supervisor/src/viewer/index.js. -- I removed the "/" before query param "?" . Since my link was showing in broken state in the pull request.
getReportURL: (url, pullRequestId, pullRequestSHA, owner, repo) => { const id = token.create({ pullRequestId, pullRequestSHA, owner, repo }, secret); return
${url}?id=${id}; }
With above changes - the flow worked without any issues.
Thanks !
@baraths84 I'm glad to hear that it worked for you 👏
There seems to be some changes either in the way how Lambda headers are normalized (lowercase) or how github headers are sent. I'm going to investigate that and implement necessary fixes in the stable release.
Thank you for debugging and helping to identify these issues.
vI have configured the AWS lambda and gateway but Github web hook during PULL Request event POST call returning the below error:
POST Response code : 422 POST Response Body :
Request Header :
Request Body :
Any pointers please @radekk . Thanks