This repository was archived by the owner on Nov 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
This repository was archived by the owner on Nov 15, 2021. It is now read-only.
Usage with serverless framework #17
Copy link
Copy link
Open
Description
I've spent quite some time using this package with the serverless framework with https://github.com/UnitedIncome/serverless-python-requirements.
I always get an unable to import error, whatever version of python I am using (I've mostly tried 3.7 and 3.6).
Has anyone ever managed to use this lib with a similar setup?
serverless.yml:
service: render-test
frameworkVersion: '2'
custom:
pythonRequirements:
dockerizePip: non-linux
# dockerImage: lambdaci/lambda:python3.6
zip: true
provider:
name: aws
runtime: python3.6
lambdaHashingVersion: '20201221'
functions:
render:
handler: handler.main
events:
- http:
path: /render
method: get
plugins:
- serverless-python-requirements
handler.py:
import json
import boto3
from bpy_lambda import bpy
s3 = boto3.resource('s3')
BUCKET_NAME = '###'
def main(event, context):
s3.Bucket(BUCKET_NAME).download_file('###', '###')
bpy.ops.wm.open_mainfile(filepath="###", load_ui=False)
bpy.context.scene.render.filepath = "rendertest.png"
bpy.context.scene.render.resolution_x = 1500
bpy.context.scene.render.resolution_y = 1500
bpy.ops.render.render()
s3.Bucket(BUCKET_NAME).upload_file('rendertest.png', 'test/rendertest.png')
response = {"statusCode": 200, "body": json.dumps({"hello": "hello"})}
return response
Error when running:
yarn serverless invoke -f render --stage test --aws-profile ###
yarn run v1.22.5
warning package.json: No license field
$ /Users/###/node_modules/.bin/serverless invoke -f render --stage test --aws-profile ###
{
"errorMessage": "Unable to import module 'functions/render'"
}
Serverless Error ----------------------------------------
Invoked function failed
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 14.15.5
Framework Version: 2.54.0 (local)
Plugin Version: 5.4.3
SDK Version: 4.2.6
Components Version: 3.15.0
error Command failed with exit code 1.
Metadata
Metadata
Assignees
Labels
No labels