So I recently switched my Lambda function to python 3.9 as Python 3.6 is no longer available. This caused the library 'lxml' to break with the following error
"Unable to import module 'lambda_function': cannot import name 'etree' from 'lxml' (/opt/python/lib/python3.9/site-packages/lxml/__init__.py)"
I've tried to re-download all packages, recreate the layer, and completely build the solution from scratch to no effect.
The solution works perfectly fine on my local machine running python 3.9, however on Lambda it fails.
Just a side note, back when I created this lambda function the same error occurred, and the go-to solution was to use Python 3.6 but obviously, this is not available now.
AWS region EU-Central-1