You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see this issue is mentioned previously and from my understanding, even when building the image locally, we still need to specify ImageUri in either case. Is this correct? If so, does the documentation need updating?
The text was updated successfully, but these errors were encountered:
You need to build your function locally in order to execute it. Building is required if the function type is Image. However if you are using an interpreted language like python and if you are using Zip lambda functions, you can use sam local invoke directly (however this one will also fail if you have external dependencies).
When you first run sam init and instantiate the application template, you should see that ImageUri is missing in the template. Instead it contains build time parameters which is required to build your function locally (like DockerTag which will be used to tag image locally).
After you run sam build locally, you can check built template under .aws-sam/build/template.yaml and you can see that it has ImageUri field with some values which is pointing to locally build image (eg. helloworldfunction:python3.12-v1).
tl;dr sam local invoke needs everything to be ready before executing the function locally. We can update our error message to ask users to run sam build which could help them to fix this issue.
Running
sam local start-api
withPackageType: Image
but not specifying anImageUri
gives the following error:samcli.commands.local.lib.exceptions.InvalidIntermediateImageError: ImageUri not provided for Function: UserFunction of PackageType: Image
But this documentation excerpt (Example 2) implies that it should be possible.
I see this issue is mentioned previously and from my understanding, even when building the image locally, we still need to specify
ImageUri
in either case. Is this correct? If so, does the documentation need updating?The text was updated successfully, but these errors were encountered: