2

I already had an API Gateway API as the trigger for my AWS Lambda function. However when I tried to add another API as a trigger to the same AWS Lambda, it threw an error saying that

There was an error creating the trigger: An integration is already present on this method.

Even when I delete the trigger already present from the configuration window of Lambda, it still shows that the trigger is present. How can I add multiple API Gateway APIs as triggers for the same lambda function ?

3
  • I believe an API Gateway Endpoint can only be used with a single Lambda integration. However didn't find any explicit document stating the same. Commented Jan 12, 2017 at 12:30
  • All you may need to do is change the name of the api when you set the trigger. Probably you are using the same name that you used previously and it come pre-populated, so likely to get unnoticed. Commented Sep 19, 2017 at 9:18
  • You can delete the API Gateway trigger from the Lambda interface, but it seems like you still actually have to go to the API Gateway interface and delete the method that was calling your function there too. I had to do this when creating a new version of my function and tried to attach API Gateway to it again. Commented Aug 13, 2020 at 3:08

2 Answers 2

2

You can setup it via API Gateway console.

  • Create the Lambda function via Lambda without providing a trigger
  • Go to API Gateway Console
  • Create an API.
  • Create a resource and method
  • Select the Lambda function you want to trigger by the method
  • Create an other API/method
  • Select the Lambda function you want to trigger by the method

Since you are creating the trigger/integration via API Gateway Console, API Gateway will setup the proper permission to allow API Gateway to invoke your Lambda function on multiple APIs/methods.

Sign up to request clarification or add additional context in comments.

Comments

0

In the API Gateway, we cannot make entries with the same resource name. When you have created a trigger it's already created and again you are trying to create another one. So we have to clear the previous one and then try again or else we can update it going into the API Gateway interface.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.