jugaad-py / jugaad-trader

Unofficial python client for Zerodha
https://marketsetup.in/documentation/jugaad-trader/
157 stars 112 forks source link

Regarding creating the lambda function #28

Closed bpkapkar closed 3 years ago

bpkapkar commented 3 years ago

I am trying to deploy the code of jugad trader on AWS lambda but getting multiple error of dependency. As per the instruction of creating the layer I am created python folder and in that pip install jugaad-trader -t . once that is done I have zipped it then uploaded in layer

Code snippet

import json

from kiteconnect import KiteConnect

from jugaad_trader import Zerodha

def lambda_handler(event, context):

TODO implement

return {
    'statusCode': 200,
    'body': json.dumps('Hello from Lambda!')
}

Error

Below is the error with cryptography library

Test Event Name test

Response { "errorMessage": "Unable to import module 'lambda_function'" }

Function Logs START RequestId: 0ae8436a-b7f0-4e33-b799-34559934c0fa Version: $LATEST Unable to import module 'lambda_function': No module named 'cryptography.hazmat.bindings._openssl'

END RequestId: 0ae8436a-b7f0-4e33-b799-34559934c0fa REPORT RequestId: 0ae8436a-b7f0-4e33-b799-34559934c0fa Duration: 0.50 ms Billed Duration: 1 ms Memory Size: 128 MB Max Memory Used: 77 MB Init Duration: 993.97 ms

Request ID 0ae8436a-b7f0-4e33-b799-34559934c0fa

Additional context Trying to figure out dependency or steps by step to create or is there any need of modification. Please let me know in case any additional information is required

sevakram commented 3 years ago

Hi Please share the complete error trace, right now it's not clear which line caused error

bpkapkar commented 3 years ago

The code is working fine on the PC but it's not working on the serverless cloud i.e AWS Lambda This is the error that is related to cryptography.hazmat.bindings._openssl' unable to import this code library.

As per the code, we are just trying to import the library

from jugaad_trader import Zerodha

if this works then I can write my code then I can write my logic further

Error from lambda START RequestId: 0ae8436a-b7f0-4e33-b799-34559934c0fa Version: $LATEST Unable to import module 'lambda_function': No module named ['cryptography.hazmat.bindings._openssl)))

bpkapkar commented 3 years ago

the issue got resolved can you close the ticket, it was an error with the package building process