we-promise/sure · error · StandardError
Lunchflow provider is not configured
Error message
Lunchflow provider is not configured
What it means
AuthenticationError raised when the cookie/crumb bootstrap raises a generic Faraday::Error (connection failure, TLS error, timeout, DNS) before any crumb is obtained — the rescue converts the transport error into an auth error with the Faraday message appended. The 429 case is handled separately as RateLimitError, so this specifically means the bootstrap HTTP requests themselves failed, not that Yahoo rejected credentials.
Source
Thrown at app/models/lunchflow_item.rb:38
has_many :lunchflow_accounts, dependent: :destroy
has_many :accounts, through: :lunchflow_accounts
scope :active, -> { where(scheduled_for_deletion: false) }
scope :syncable, -> { active }
scope :ordered, -> { order(created_at: :desc) }
scope :needs_update, -> { where(status: :requires_update) }
def destroy_later
update!(scheduled_for_deletion: true)
DestroyJob.perform_later(self)
end
def import_latest_lunchflow_data
provider = lunchflow_provider
unless provider
Rails.logger.error "LunchflowItem #{id} - Cannot import: Lunchflow provider is not configured (missing API key)"
raise StandardError.new("Lunchflow provider is not configured")
end
LunchflowItem::Importer.new(self, lunchflow_provider: provider).import
rescue => e
Rails.logger.error "LunchflowItem #{id} - Failed to import data: #{e.message}"
raise
end
def process_accounts
return [] if lunchflow_accounts.empty?
results = []
# Only process accounts that are linked and have active status
lunchflow_accounts.joins(:account).merge(Account.visible).each do |lunchflow_account|
begin
result = LunchflowAccount::Processor.new(lunchflow_account).process
results << { lunchflow_account_id: lunchflow_account.id, success: true, result: result }
rescue => eView on GitHub (pinned to e69894adb9)
Solutions
- Check outbound connectivity: curl -I https://fc.yahoo.com from the same host
- Fix DNS/proxy/firewall rules to allow fc.yahoo.com and query1.finance.yahoo.com
- Update CA certificates / Faraday TLS config if the handshake fails
- Retry with backoff for transient resets; this rescue has no built-in retry
- Verify the Faraday connection object in Provider::YahooFinance is configured with a working adapter
Example fix
# before provider.fetch_security_prices(symbol: s, start_date: a, end_date: b) # raises AuthenticationError: Failed to authenticate with Yahoo Finance: connection refused # after (caller-side retry for transient transport failures) begin provider.fetch_security_prices(symbol: s, start_date: a, end_date: b) rescue Provider::YahooFinance::AuthenticationError => e raise unless /timeout|reset|refused|could not resolve/i.match?(e.message) sleep 30 retry if (tries += 1) < 3 raise end
Defensive patterns
Strategy: retry
Validate before calling
require "net/http"
uri = URI("https://fc.yahoo.com")
Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.head("/") } # fail fast if egress blocked Try / catch
tries = 0 begin provider.fetch_security_prices(symbol: s, start_date: a, end_date: b) rescue Provider::YahooFinance::AuthenticationError => e transient = /timeout|reset|refused|could not resolve|ssl/i.match?(e.message) raise unless transient && (tries += 1) < 3 sleep(30) retry end
Prevention
- Verify outbound access to fc.yahoo.com and query1.finance.yahoo.com in deployment checks
- Keep CA certificates and the Faraday adapter stack current
- Don't treat transport-failure auth errors as credential problems — check the appended Faraday message
When it happens
Trigger: fetch_cookie_and_crumb hitting network failure to fc.yahoo.com or query1.finance.yahoo.com (DNS refusal, TLS handshake failure, connection reset); proxy/firewall blocking Yahoo; IPv6 misrouting on the host; Faraday adapter misconfiguration raising a non-429 Faraday::Error.
Common situations: Server with no outbound internet or strict egress firewall; captive DNS in CI containers; expired CA bundle breaking TLS to Yahoo; flaky home/office uplink during nightly syncs.
Related errors
- invalid_import_record
- Mercury provider is not configured
- request_failed
- Network error after #{max_retries} retries: #{e.message}
- network_error
AI-assisted analysis of we-promise/sure@e69894adb9 (2026-08-21).
Data as JSON: /api/errors/647c6b196905eeae.
Report an issue: GitHub.