I am building a cdk script for some lambdas and gateways. I am busy packing up my layers, but get the error staging.relativeStagedPath is not a function
.
The code that sets it off is this, specifialy the Code.from_asset line.
self.sqlalchemy_layer = LayerVersion(
self,
"Sqlalchemy-Lambda-Layer",
compatible_runtimes=[Runtime.PYTHON_3_8],
code=Code.from_asset("./src/layers/sqlalchemy-layer.zip"),
)
I confirmed that the code does exist and I get a 'file not found error' if I mess around with the location of my layer.
I also confirmed that the from_asset function does take a string pointing towards a zip file.
def from_asset(
cls,
path: builtins.str,
*,
...
) -> "AssetCode":
"""Loads the function code from a local disk path.
:param path: Either a directory with the Lambda code bundle or a .zip file.
Changing the code to point to a directory with the code bundled instead of a zip gives the same issue.
Does anyone know why I am getting this error?