Collision of lambda method

Hi!

After research why pagy was not working on my jets app I discover the method lambda which is included on the helpers or somewhere causing a collision with ruby lamba.

I tried creating a fork renaming the method lambda to aws_lambda and everything works well until now.

What I don’t understood is why my fork works well, I just renamed the method, maybe this method is unused?

If it makes sense I would create a PR.

Thanks!

@ceritium Interesting. The def lambda method is definitely being used. One spot can think off at the top of my head is for prewarming. The prewarming function uses the lambda client to call controller lambda functions in the app with a dummy payload to keep the other functions warm. It may be used in other places.

Just searched through the pagy gem and see why it’s colliding now. The gem uses the lambda keyword to create ruby blocks of code.

Didn’t think about the lambda keyword when defining the method :man_facepalming:t2:

RE: If it makes sense I would create a PR.

Think renaming it to the aws_lambda method is good. It’s pretty short name still. Would add a comment above the method to remind us about the lambda ruby keyword for posterity.

Also, need to search through the code base for lambda. to and replace it with aws_lambda. Happy to review this PR if you would like to take a stab. Otherwise, will take a look at it when got some time.

Thanks! Tung

1 Like

@tung cool!

I created this PR https://github.com/tongueroo/jets/pull/232

As you said the prewarming was failing but I didn’t noticed it. I am integrating raven in my test project to be noticed of all the errors.

I think that makes sense continue the conversation on the PR. The PR is not ready yet because some tests are failing, they are failing too on master (on my local environment at least).

Thanks.