Hey Everyone. (My first time posting here) I have ...
# help
t
Hey Everyone. (My first time posting here) I have a lambda on an EventBus that has to in turn invoke another lambda, but it seems like I have some kinda of permissions issue, as the second lambda never gets invoked. (Also no errors or logs in CloudWatch) If anyone has come across this issue before and have some links that I can read into to resolve the issue that would really be great. PS: Invoking the secondary lambda from a lambda attached to API Gateway works 100%
f
Hey @Theo Ferreira, welcome!
Invoking the secondary lambda from a lambda attached to API Gateway works 100%
Do you mean the first Lambda makes an http request to the Api endpoint, and that works?
t
technically the endpoint call is made with postman to API Gateway, and API Gateway invokes a lambda, and then in turn invokes another lambda that does stuff (and that works), but if the initial lambda is attached to eventBus (and gets invoked by an event on EventBus) it does not invoke the secondary lambda
The secondary Lambda in both cases is the same Lambda, the first case is just invoked via API Gateway and the other via EventBus
f
Got it!
Can I see how you are creating the first Lambda invoked by EventBus?
t
Copy code
export default {
  handler: `${__dirname.split(process.cwd())[1].substring(1).replace(/\\/g, '/')}/handler.main`,
  timeout: 900,
  events: [
    {
      eventBridge: {
        eventBus: "${self:provider.environment.RESOURCE_PREFIX}-${self:provider.environment.EVENT_BRIDGE_BUS}",
        pattern: {
          source: ['post.INSERT','post.MODIFY','post.REMOVE'],
        }
      }
    }
  ],
  iamRoleStatements: [ ... (permissions to invoke a lambda) ...],
};
is this what you meant ?
(the event on eventBus is from a dynamoDB Steam), and I can confirm this lambda on eventBus does get invoked, it just never invokes the second lambda
Log statements around the invoke command prints to CloudWatch, but the second lambda does not generate any CloudWatch log
f
Oh this is a Serverless Framework project?
t
Yes
f
In the log of the first Lambda, can you enable the AWS SDK logging, and then see what the Lambda invoke call returns?
t
Sorry is this not the right workspace for this ? I thought that is what Serverless Stack is
f
Oh don’t worry man! I will help with whatever I can 🙂
t
Thanks @Frank I will try this in a little and see if I can see what the logs output
@Frank thought I would just mention that I did come right with this thanks a lot, once the debug was turned on in SDK, I was able to spot the issue, and corrected it rather quickly
f
Awesome! Glad it’s working.