rubyonjets/jets

How use helper method in lambda function?

Closed this issue · 1 comments

Checklist

  • Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System MacOS 10.15.3
Jets 2.3.16
Ruby 2.7.0

Expected Behaviour

I am going to use helper method in lambda function.
I have added include ApplicationHelper in app/functions/my_function.rb

Current Behavior

But I am getting the error -
uninitialized constant ApplicationHelper

Code Sample

app/functions/my_function.rb

include ApplicationHelper
def lambda_handler(event:, context:)
  puts event
  puts context

  # get_event_details is defined in ApplicationHelper
  details = get_event_details(event) 
end

app/helpers/application_helper.rb

module ApplicationHelper
   def get_event_details(event)
      #code
   end
end

Hi @tongueroo
Yes, sorry this is a question, not a bug.
I have asked this question here on Jets community.
Can you please help me?
Thank you.