Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e.CanvasRenderingContext2dInit is not a function #7

Open
carlesandres opened this issue Jan 29, 2020 · 2 comments
Open

e.CanvasRenderingContext2dInit is not a function #7

carlesandres opened this issue Jan 29, 2020 · 2 comments

Comments

@carlesandres
Copy link

I am getting this error after following the steps in this repo.

e.CanvasRenderingContext2dInit is not a function

The way I construct my lambda is by bundling with Parcel from the function's entry point, letting it figure out what to bundle, then zipping it and uploading.
My bundle is definitely including a copy of canvas from my local node_modules folder and is very likely the cause of this error.
That said, I am new to lambdas and I find it difficult to infer from the readme how people workaround the issue of excluding the local 'canvas' module from the zip they upload to AWS.
If I managed to finally exclude my local copy of canvas from the zip it, is there a change that const Canvas = require('canvas') won't pick the canvas module from the layer?

@jwerre
Copy link
Owner

jwerre commented Feb 10, 2020

@carlesandres It may be loading canvas from your node_modules directory. Make sure you're not deploying canvas with your function, you don't need it since it's already in the layer. Maybe just put it as a devDependancy.

@carlesandres
Copy link
Author

carlesandres commented Feb 10, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants