Describe the bug
amplify 1.1.6 does not allow restful api to use existing Lambda
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Prior to upgrade, I was using 0.1.38 and amplify was able to pull all Lambda functions from the account in the region that I can use in the Amplify project
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
This was intentionally removed to reduce the confusion it would cause when using with multienv.
If we allow choosing a lambda function, the same resource would be used for all the environment and break the resource isolation between environments.
We do support choosing a lambda function that is provisioned using CLI as we create a separate function for each environment.
Please feel free to re-open if this doesn't answer your question.
@kangks if you really want to use the lambda function in the aws account, just use the aws-sdk/client/lambda
.
import Amplify, { Auth } from 'aws-amplify';
...
...
...
Auth.currentCredentials()
.then(credentials => {
const lambda = new Lambda({
region: "us-east-1",
credentials: Auth.essentialCredentials(credentials)
});
var pullParams = {
FunctionName : 'api-lambda-get',
InvocationType : 'RequestResponse',
LogType : 'None'
};
lambda.invoke(pullParams, function(err, data) {
if (err) {
console.err(err);
} else {
console.log(JSON.parse(data.Payload));
}
});
});
How can we reuse lambda functions across projects?
Most helpful comment
How can we reuse lambda functions across projects?