probot / adapter-aws-lambda-serverless

An extension for running Probot on Lambda
ISC License
94 stars 36 forks source link

Incompatible with Probot v11 #58

Closed helaili closed 3 years ago

helaili commented 3 years ago

Got this error with probot 11.0.1 and 11.0.5. Downgrading to 10.19.0 solved it.

HttpError: Missing 'issuer' claim ('iss') in assertion
at /var/task/node_modules/@octokit/request/dist-node/index.js:66:23
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async getInstallationAuthentication (/var/task/node_modules/@octokit/auth-app/dist-node/index.js:258:7)
at async hook (/var/task/node_modules/@octokit/auth-app/dist-node/index.js:424:7)
at async Job.doExecute (/var/task/node_modules/bottleneck/light.js:405:18)
gr2m commented 3 years ago

What's your setup? Is your code open source? Do you see any deprecation warnings when you run your app with 10.19.0?

helaili commented 3 years ago

The code is here and yes, I do have some warnings such as this one 👇

Deprecation: [probot] "id" option is deprecated. Use "appId" instead

In terms of setup, it's just a simple probot app that I'm deploying as an AWS lambda with the serverless command line. It's configured with .env.{stage} files and the environment is properly populated in AWS.

gr2m commented 3 years ago

The deprecation warning is why it fails with the new version, this line here is the problem

https://github.com/probot/serverless-lambda/blob/c2a6ec82b2c855636936f92375c24af9d3de2784/index.js#L12

I'm currently working on creating an example app with deployment to AWS Lambda with Serverless. Once that's done I'll update the adapter. But the current app is not working, I don't know why, I'm not very familiar with Lambda/Serverless, could you have a look?

https://github.com/probot/example-aws-lambda-serverless/pull/1

See also the discussion at https://github.com/probot/probot/pull/1467#issuecomment-766306947

axel3rd commented 3 years ago

In addition, Probot v11 incompatibilities concerns a custom GitHub URL endpoint (sample: GitHub Enterprise).

Switching a probot app v10 (which is working) into v11, the GitHub Enterprise URL is not taken into account (default GitHub.com is used):

HttpError: request to https://api.github.com/app/installations/42/access_tokens failed, reason: getaddrinfo ENOTFOUND api.github.com api.github.com:443

// Details:
request: {
    method: "POST"
    url: "https://api.github.com/app/installations/42/access_tokens"
    headers: {
        "accept": "application/vnd.github.machine-man-preview+json",
        "user-agent": "probot/11.0.5 octokit-core.js/3.2.5 Node.js/10.23.1 (linux; x64)",
        "authorization": "bearer [REDACTED]",
        "content-length": 0
}

The GHE_HOST sysenv seems not used.

It could perhaps be linked to new Probot constructor usage or new GHE_BASEURL prop (1415):

https://github.com/probot/serverless-lambda/blob/c2a6ec82b2c855636936f92375c24af9d3de2784/index.js#L11-L15

But was introduced in 10.17 and downgrade v11 to v10.19.0 is working fine for me 🤔.

gr2m commented 3 years ago

I've a pull request which will update this adapter to Probot v11, it also changes its APIs. Could you have a look? https://github.com/probot/adapter-aws-lambda-serverless/pull/59

I'm not very familiar with the serverless framework. If you could check instructions in the README I'd appreciate it

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 2.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: