1
votes

I'm using a Google library called DialogFlow. And in the last 6 or 7 days all the lambda functions that import this library, started to give initialization error.

I noticed that it does pretty much the same time the serverless framework has been upgraded from version 1.31.0 to 1.32.0. In my serverless.yml file I put: frameworkVersion: ">=1.0.0 <2.0.0"

If I compile a simple code like this:

import dialogflow


def hi(event, context):
    return {
        "statusCode": 200,
        "body": "ahhh hiiii"
    }

The error generated in lambda is as follows:

START RequestId: 907fe23d-c2b1-11e8-b745-27859211eefc Version: $LATEST module initialization error: The 'google-api-core' distribution was not found and is required by the application

END RequestId: 907fe23d-c2b1-11e8-b745-27859211eefc REPORT RequestId: 907fe23d-c2b1-11e8-b745-27859211eefc Duration: 47.02 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 32 MB module initialization error The 'google-api-core' distribution was not found and is required by the application

1

1 Answers

0
votes

The problem is libraries that use low-level language (usually in C). And when serverless generates packets, those languages ​​are not sent.

The solution: Enable docker packaging, through the serverless-python-requirements plugin.

custom:
  pythonRequirements:
    dockerizePip: true