简体   繁体   中英

How to use OAuth with jira-python and AWS Lambda

I wish to create issues in JIRA from an AWS Lambda function. I am getting stuck on the first couple of steps for OAuth where I need to use JIRA's AppLinks to pair with an application. Do I need to build a custom client? If so, how? If not, what do I need to do?

Any help is appreciated, thanks!

I found this question via Google looking for an answer to the same problem. I'm adding an answer in case someone else stumbles upon this question looking for an answer.

The jira python package does not include cryptography which you'll need to add as a pip requirement.

pycrypto - This is required for the RSA-SHA1 used by OAuth. Please note that it's not installed automatically, since it's a fairly cumbersome process in Windows. On Linux and OS X, a pip install pycrypto should do it.

https://jira.readthedocs.io/en/master/installation.html#dependencies

Depending on your platform it may not be as simple as adding the above and deploying due to native code requirements

cryptography contains native code and that code is compiled for the architecture (and OS) of the current machine. The AWS lambda documentation currently appears to claim that zipping up your local directory will work, but that's patently untrue.

https://github.com/pyca/cryptography/issues/3051#issuecomment-234093766

To resolve you can compile your function's requirements on an EC2 AMI or docker container.

If you are using serverless you can use the serverless-python-requirements plugin which is what I used to resolved these issue for me.

In your serverless.yml file you can specify compiling packages via docker.

custom:
  pythonRequirements:
    dockerizePip: true

found via https://www.npmjs.com/package/serverless-python-requirements#cross-compiling

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM