Undefined method `default_url_options' for nil:NilClass

I made an endpoint and it was working on my local however after deployment to AWS I got this issue. This is happening at actionmailer’s initialization in Jets.once method in the lambda function. I do not use any mailer and I have no clue so far. Any help would be appreciated. Thank you.

Unknown application error occurred
Init
Init error when loading handler handlers/controllers/converters_controller.upload
{
“errorMessage”: “undefined method default_url_options' for nil:NilClass", "errorType": "Init<NoMethodError>", "stackTrace": [ "/opt/ruby/gems/2.5.0/gems/jets-2.3.12/lib/jets/internal/turbines/jets/mailer.rb:12:inblock in class:Mailer’”,
“/opt/ruby/gems/2.5.0/gems/jets-2.3.12/lib/jets/booter.rb:134:in block (2 levels) in run_turbines'", "/opt/ruby/gems/2.5.0/gems/jets-2.3.12/lib/jets/booter.rb:133:ineach’”,
“/opt/ruby/gems/2.5.0/gems/jets-2.3.12/lib/jets/booter.rb:133:in block in run_turbines'", "/opt/ruby/gems/2.5.0/gems/jets-2.3.12/lib/jets/booter.rb:131:ineach’”,
“/opt/ruby/gems/2.5.0/gems/jets-2.3.12/lib/jets/booter.rb:131:in run_turbines'", "/opt/ruby/gems/2.5.0/gems/jets-2.3.12/lib/jets/booter.rb:18:inboot!’”,
“/opt/ruby/gems/2.5.0/gems/jets-2.3.12/lib/jets/core.rb:18:in boot'", "/opt/ruby/gems/2.5.0/gems/jets-2.3.12/lib/jets/core.rb:125:inonce’”,
“/var/task/handlers/controllers/converters_controller.rb:3:in <top (required)>'", "/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:inrequire’”,
“/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require’”
]
}

Thanks for the report. Interestingly, when digging into Ruby 2.7 a few days ago, also ran into this. But deployed again and then was unable to reproduce. It seems like one of those tough bugs that happens intermittently.

Seems like Lambda Environment can get slightly different environments, maybe based on different AMIs? And depending on which AMI the lambda function happens to get the bug surfaces.

Thought it was specific to the Lambda Ruby 2.7 runtime at the time though. But this makes it obvious that its also happening in the Ruby 2.5 runtime. Bummer!

Released temp fix https://github.com/tongueroo/jets/pull/446 Am not a fan of the fix because it actually hides the issue. But better than a crash for actionmailer, which is not as used much. Will dig into a better fix later.

Released in jets 2.3.13.

Thank you for this. I’m using AWS Lambda at Tokyo region with ruby2.5. Maybe that’s the reason!? After upgrade to jets-2.3.13, it’s working fine.

Hello :slight_smile:

This is my first post, so, first, thanks a lot for this great Jets tool/framework!


It seems that we are having the exact same problem with our application, but… it doesn’t seem to be random, it seems to happen all the time now.

{“errorMessage”:“undefined method default_url_options' for nil:NilClass","errorType":"Init\u003cNoMethodError\u003e","stackTrace":["/opt/ruby/gems/2.5.0/gems/jets-1.9.16/lib/jets/internal/turbines/jets/mailer.rb:12:inblock in \u003cclass:Mailer\u003e’”,"/opt/ruby/gems/2.5.0/gems/jets-1.9.16/lib/jets/booter.rb:66:in block (2 levels) in run_turbines'","/opt/ruby/gems/2.5.0/gems/jets-1.9.16/lib/jets/booter.rb:65:ineach’","/opt/ruby/gems/2.5.0/gems/jets-1.9.16/lib/jets/booter.rb:65:in block in run_turbines'","/opt/ruby/gems/2.5.0/gems/jets-1.9.16/lib/jets/booter.rb:63:ineach’","/opt/ruby/gems/2.5.0/gems/jets-1.9.16/lib/jets/booter.rb:63:in run_turbines'","/opt/ruby/gems/2.5.0/gems/jets-1.9.16/lib/jets/booter.rb:19:inboot!’","/opt/ruby/gems/2.5.0/gems/jets-1.9.16/lib/jets/core.rb:18:in boot'","/opt/ruby/gems/2.5.0/gems/jets-1.9.16/lib/jets/core.rb:125:inonce’","/var/task/handlers/controllers/users_controller.rb:3:in \u003ctop (required)\u003e'","/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:inrequire’","/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require’"]}

We are using Jets v1.9.16 (I know, a bit old :-/ )
And ruby 2.5.7

But… we are also using action_mailer (to send emails through SMTP) and properly configured it (it was working untill we deployed a new version of our app recently).

So, what should we do?
Should we upgrade to last jets version? If so, will we still be able to use action_mailer properly?

Thanks in advance for any advice :slight_smile:

Hi Gurus,

Same issue here :frowning: I upgrade Ruby on Jets on the last version but all my email’s functionnality are down now.

Please find the log below:

Blockquote | 2020-04-01 19:09:56.351 | END RequestId: a7dbc105-04ef-4d99-be6c-f825f1d21bac |
| 2020-04-01 19:09:56.351 | REPORT RequestId: a7dbc105-04ef-4d99-be6c-f825f1d21bac Duration: 535.38 ms Billed Duration: 600 ms Memory Size: 1536 MB Max Memory Used: 242 MB Init Duration: 5154.44 ms|
| 2020-04-01 19:09:56.349 | RubyError: Errno::EAFNOSUPPORT: Address family not supported by protocol - socket(2) for “localhost” port 25 |
| 2020-04-01 19:09:56.349 | /var/lang/lib/ruby/2.5.0/net/smtp.rb:539:in initialize' | | 2020-04-01 19:09:56.349 | /var/lang/lib/ruby/2.5.0/net/smtp.rb:539:inopen’ |
| 2020-04-01 19:09:56.349 | /var/lang/lib/ruby/2.5.0/net/smtp.rb:539:in tcp_socket' | | 2020-04-01 19:09:56.349 | /var/lang/lib/ruby/2.5.0/net/smtp.rb:549:inblock in do_start’ |
| 2020-04-01 19:09:56.349 | /var/lang/lib/ruby/2.5.0/timeout.rb:93:in block in timeout' | | 2020-04-01 19:09:56.349 | /var/lang/lib/ruby/2.5.0/timeout.rb:103:intimeout’|
| 2020-04-01 19:09:56.349 | /var/lang/lib/ruby/2.5.0/net/smtp.rb:548:in do_start' | | 2020-04-01 19:09:56.349 | /var/lang/lib/ruby/2.5.0/net/smtp.rb:518:instart’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:109:in start_smtp_session'| | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:100:indeliver!’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:2159:in do_delivery' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:260:inblock in deliver’|
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/actionmailer-6.0.2.2/lib/action_mailer/base.rb:589:in block in deliver_mail'| | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/notifications.rb:180:inblock in instrument’|
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/notifications/instrumenter.rb:24:in instrument'| | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/notifications.rb:180:ininstrument’|
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/actionmailer-6.0.2.2/lib/action_mailer/base.rb:587:in deliver_mail'| | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:260:indeliver’|
| 2020-04-01 19:09:56.349 | /var/lang/lib/ruby/2.5.0/delegate.rb:83:in method_missing' | | 2020-04-01 19:09:56.349 | /var/task/app/models/manager_invitation_token.rb:24:insend_email’|
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/callbacks.rb:429:in block in make_lambda'| | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/callbacks.rb:239:inblock in halting_and_conditional’|
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/callbacks.rb:518:in block in invoke_after' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/callbacks.rb:518:ineach’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/callbacks.rb:518:in invoke_after' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/callbacks.rb:136:inrun_callbacks’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/callbacks.rb:827:in _run_create_callbacks' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/callbacks.rb:332:in_create_record’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/timestamp.rb:111:in _create_record' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/persistence.rb:906:increate_or_update’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/callbacks.rb:328:in block in create_or_update'| | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/callbacks.rb:135:inrun_callbacks’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/callbacks.rb:827:in _run_save_callbacks' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/callbacks.rb:328:increate_or_update’|
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/timestamp.rb:129:in create_or_update'| | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/persistence.rb:470:insave’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/validations.rb:47:in save' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/transactions.rb:315:inblock in save’|
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/transactions.rb:375:in block in with_transaction_returning_status' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:281:inblock in transaction’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:280:in block in within_new_transaction' | | 2020-04-01 19:09:56.349 | /var/lang/lib/ruby/2.5.0/monitor.rb:235:inmon_synchronize’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:278:in within_new_transaction' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:281:intransaction’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/transactions.rb:212:in transaction' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/transactions.rb:366:inwith_transaction_returning_status’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/transactions.rb:315:in save'| | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/activerecord-6.0.2.2/lib/active_record/suppressor.rb:44:insave’|
| 2020-04-01 19:09:56.349 | /var/task/app/controllers/manager_invitation_tokens_controller.rb:22:in create' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/base.rb:83:indispatch!’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/middleware/main.rb:27:in call!' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/middleware/main.rb:22:incall’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/middleware/main.rb:49:in call' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/rack-2.2.2/lib/rack/etag.rb:27:incall’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/rack-2.2.2/lib/rack/conditional_get.rb:40:in call' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/rack-2.2.2/lib/rack/head.rb:12:incall’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:266:in context'| | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:260:incall’|
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/middleware/local.rb:40:in call' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/middleware/reloader.rb:11:inblock in call’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/middleware/reloader.rb:9:in synchronize' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/middleware/reloader.rb:9:incall’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/rack-2.2.2/lib/rack/method_override.rb:24:in call' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/middleware/cors.rb:18:incall’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/rack-2.2.2/lib/rack/runtime.rb:22:in call' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/shotgun-0.9.2/lib/shotgun/static.rb:14:incall’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/middleware.rb:7:in call' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/rack/adapter.rb:21:inprocess’ |
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/base.rb:67:in process!'| | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/controller/base.rb:35:inprocess’ |
| 2020-04-01 19:09:56.349 | app/controllers/manager_invitation_tokens_controller.rb:1:in run' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/processors/main_processor.rb:32:ininstance_eval’|
| 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/processors/main_processor.rb:32:in run' | | 2020-04-01 19:09:56.349 | /opt/ruby/gems/2.5.0/gems/jets-2.3.13/lib/jets/core.rb:120:inprocess’ |
| 2020-04-01 19:09:56.349 | /var/task/handlers/controllers/manager_invitation_tokens_controller.rb:15:in create'| | 2020-04-01 19:09:56.349 | /var/runtime/lib/lambda_handler.rb:24:incall_handler’|
| 2020-04-01 19:09:56.349 | /var/runtime/lib/runtime.rb:42:in <main>' | | 2020-04-01 19:09:56.349 | Error raised from handler method | | 2020-04-01 19:09:56.349 | {| | 2020-04-01 19:09:56.349 | "errorMessage": "Address family not supported by protocol - socket(2) for \"localhost\" port 25",| | 2020-04-01 19:09:56.349 | "errorType": "Function<Errno::EAFNOSUPPORT>", | | 2020-04-01 19:09:56.349 | "stackTrace": [ | | 2020-04-01 19:09:56.349 | "/var/lang/lib/ruby/2.5.0/net/smtp.rb:539:ininitialize’", |
| 2020-04-01 19:09:56.349 | “/var/lang/lib/ruby/2.5.0/net/smtp.rb:539:in open'", | | 2020-04-01 19:09:56.349 | "/var/lang/lib/ruby/2.5.0/net/smtp.rb:539:intcp_socket’”, |
| 2020-04-01 19:09:56.349 | “/var/lang/lib/ruby/2.5.0/net/smtp.rb:549:in block in do_start'", | | 2020-04-01 19:09:56.349 | "/var/lang/lib/ruby/2.5.0/timeout.rb:93:inblock in timeout’”, |
| 2020-04-01 19:09:56.349 | “/var/lang/lib/ruby/2.5.0/timeout.rb:103:in timeout'",| | 2020-04-01 19:09:56.349 | "/var/lang/lib/ruby/2.5.0/net/smtp.rb:548:indo_start’”, |
| 2020-04-01 19:09:56.349 | “/var/lang/lib/ruby/2.5.0/net/smtp.rb:518:in start'", | | 2020-04-01 19:09:56.349 | "/opt/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:109:instart_smtp_session’”,|
| 2020-04-01 19:09:56.349 | “/opt/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:100:in deliver!'", | | 2020-04-01 19:09:56.349 | "/opt/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:2159:indo_delivery’”, |
| 2020-04-01 19:09:56.349 | “/opt/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:260:in block in deliver'",| | 2020-04-01 19:09:56.349 | "/opt/ruby/gems/2.5.0/gems/actionmailer-6.0.2.2/lib/action_mailer/base.rb:589:inblock in deliver_mail’”,|
| 2020-04-01 19:09:56.349 | “/opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/notifications.rb:180:in block in instrument'",| | 2020-04-01 19:09:56.349 | "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/notifications/instrumenter.rb:24:ininstrument’”,|
| 2020-04-01 19:09:56.349 | “/opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/notifications.rb:180:in instrument'",| | 2020-04-01 19:09:56.349 | "/opt/ruby/gems/2.5.0/gems/actionmailer-6.0.2.2/lib/action_mailer/base.rb:587:indeliver_mail’”,|
| 2020-04-01 19:09:56.349 | “/opt/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:260:in deliver'",| | 2020-04-01 19:09:56.349 | "/var/lang/lib/ruby/2.5.0/delegate.rb:83:inmethod_missing’”, |
| 2020-04-01 19:09:56.349 | “/var/task/app/models/manager_invitation_token.rb:24:in send_email'",| | 2020-04-01 19:09:56.349 | "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.2.2/lib/active_support/callbacks.rb:429:inblock in make_lambda’”,

Any chance to get a patch soon?

In advance thank you for your help!

Fabien.

Dug into this. This one has been annoyingly difficult to reproduce. Deployed a test app to 6 different AWS regions in case it was region specific. Got emails from all 6 regions.

So don’t think it’s region specific. To be clear though, believe it’s happening. Just haven’t been able to reproduce myself :man_facepalming:t2:

Put together a project to hopefully help. :face_with_monocle:

Clone and deploy it.

jets deploy

Hoping someone who is getting this issue can deploy it. Wondering if you’re seeing if the config.object_id change within the same “container” consistently. Here’s my a debugging session, where the lambda function is called repeatedly with:

jets call hard_job-dig --show-log 

And it shows the same config.object_id.

$ aws-logs tail /aws/lambda/mailer-dev-hard_job-dig | grep 'config.object_id'
2020-04-15 18:50:07 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa application.rb load_default_config2 @config.object_id 47006458941220
2020-04-15 18:50:07 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa application.rb setup! @config.object_id 47006458941220
2020-04-15 18:50:07 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa mailer.rb initializer config.object_id 47006458941220
2020-04-15 18:50:08 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa config/application/development.rb config.object_id: 47006458941220
2020-04-15 18:50:08 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa application.rb configs! @config.object_id 47006458941220
2020-04-15 18:50:08 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa Jets.config.object_id 47006458941220
2020-04-15 18:50:08 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa HardJob Jets.config.object_id 47006458941220
2020-04-15 18:50:38 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa HardJob Jets.config.object_id 47006458941220
2020-04-15 18:51:00 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa HardJob Jets.config.object_id 47006458941220
2020-04-15 18:51:21 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa HardJob Jets.config.object_id 47006458941220
2020-04-15 18:51:28 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa HardJob Jets.config.object_id 47006458941220
2020-04-15 18:51:36 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa HardJob Jets.config.object_id 47006458941220
2020-04-15 18:51:47 UTC 2020/04/15/[$LATEST]c68e16ddfa204a30b34abdf36c52aefa HardJob Jets.config.object_id 47006458941220

Remember to check that you’re looking at the logs from the same Lambda container. IE: 02b1d85a58024220b85df3aa7036c8f7 in this case. Because the object_id will be different from different containers, but it should stay the same within the same Lambda container.

If you do not see the object_id change with the test app. Try switching your own project to use the debug-actionmailer branch of jets and deploying that. You can see how to do that here: https://github.com/tongueroo/jets-debug-actionmailer/blob/master/Gemfile#L4 That will indicate if it’s something specific to how the project is set up. Then we just need to track down exactly what it is.

Note, you can use JETS_ENV_EXTRA to create a new environment with the same code. Example:

JETS_ENV_EXTRA=2 jets deploy

Hi Tung,

Thank you for your quick reply!

I forget to say that we use Devise and I just see in other posts that Devise is not supported…

So maybe this issue is linked to the use of Devise, isn’t it?

Additional information: it is working perfectly in local!

Cheers,

Fabien.

RE: So maybe this issue is linked to the use of Devise, isn’t it?

Dont believe so, but unsure.

Took another stab at this. Even removed the hack with app.config.action_mailer ||= ActiveSupport::OrderedOptions.new in the latest debug-actionmailer branch. Here’s the AWS Lambda logs with 3 successive calls to jets call hard_job-dig

The first call is the cold-start, the 2nd and 3rd call is without the cold-start.

The Jets.config.object_id and Jets.config.action_mailer.object_id are 47338339889800 and 47338333821080 respectively.

$ aws-logs tail /aws/lambda/mailer-dev-hard_job-dig 
2020-04-15 19:10:58 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d START RequestId: dbe1b9ec-cab0-461c-b7db-db9b3804a62a Version: $LATEST
2020-04-15 19:10:58 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d application.rb load_default_config2 @config.object_id 47338339889800
2020-04-15 19:10:58 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d application.rb setup! @config.object_id 47338339889800
2020-04-15 19:10:58 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d mailer.rb turbine loaded
2020-04-15 19:10:58 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d mailer.rb initializer config.object_id 47338339889800
2020-04-15 19:10:59 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d application.rb configs! @config.object_id 47338339889800
2020-04-15 19:10:59 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d mailer.rb Jets.config.object_id 47338339889800
2020-04-15 19:10:59 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d mailer.rb Jets.config.action_mailer.object_id 47338333821080 (config.action_mailer)
2020-04-15 19:10:59 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d mailer.rb options 47338333821080 (config.action_mailer)
2020-04-15 19:10:59 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d HardJob Jets.config.object_id 47338339889800
2020-04-15 19:10:59 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d HardJob Jets.config.action_mailer.object_id 47338333821080 (config.action_mailer)
2020-04-15 19:10:59 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d END RequestId: dbe1b9ec-cab0-461c-b7db-db9b3804a62a
2020-04-15 19:10:59 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d REPORT RequestId: dbe1b9ec-cab0-461c-b7db-db9b3804a62a     Duration: 4.99 ms       Billed Duration: 100 ms Memory Size: 1536 MB  Max Memory Used: 157 MB Init Duration: 2439.40 ms
2020-04-15 19:11:19 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d START RequestId: 932d8b55-5fce-46ca-851c-e29b276d5f73 Version: $LATEST
2020-04-15 19:11:19 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d HardJob Jets.config.object_id 47338339889800
2020-04-15 19:11:19 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d HardJob Jets.config.action_mailer.object_id 47338333821080 (config.action_mailer)
2020-04-15 19:11:19 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d END RequestId: 932d8b55-5fce-46ca-851c-e29b276d5f73
2020-04-15 19:11:19 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d REPORT RequestId: 932d8b55-5fce-46ca-851c-e29b276d5f73     Duration: 2.17 ms       Billed Duration: 100 ms Memory Size: 1536 MB  Max Memory Used: 157 MB
2020-04-15 19:11:27 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d START RequestId: 24f44f7b-09a9-453f-8e89-d19cedb6ac0b Version: $LATEST
2020-04-15 19:11:27 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d HardJob Jets.config.object_id 47338339889800
2020-04-15 19:11:27 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d HardJob Jets.config.action_mailer.object_id 47338333821080 (config.action_mailer)
2020-04-15 19:11:27 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d END RequestId: 24f44f7b-09a9-453f-8e89-d19cedb6ac0b
2020-04-15 19:11:27 UTC 2020/04/15/[$LATEST]510107f8f4b3439c8950cd5df46afe4d REPORT RequestId: 24f44f7b-09a9-453f-8e89-d19cedb6ac0b     Duration: 2.14 ms       Billed Duration: 100 ms Memory Size: 1536 MB  Max Memory Used: 157 MB

Wondering what am missing here :face_with_monocle: This has been tough to reproduce. Hoping that someone with the issue can run this jets debug-actionmailer branch on their project and see what the logging shows. That may lead to better clues.