we-promise/sure · warning
<%= class_name %>ConnectionCleanupJob - API delete failed: #
Error message
<%= class_name %>ConnectionCleanupJob - API delete failed: #{e.message} What it means
Generated delete_connection currently resolves the item's provider and credentials and then returns nil — the actual provider API call is a commented TODO example. The rescue only catches errors raised while resolving provider/credentials or by partially enabling the example call (e.g. NoMethodError because provider.delete_connection is not implemented on the SDK). Logged as a warning and swallowed, so the job completes with no remote deletion performed.
Source
Thrown at lib/generators/provider/family/templates/connection_cleanup_job.rb.tt:52
private
def delete_connection(<%= file_name %>_item, authorization_id)
provider = <%= file_name %>_item.<%= file_name %>_provider
return unless provider
credentials = <%= file_name %>_item.<%= file_name %>_credentials
return unless credentials
# TODO: Implement API call to delete connection
# Example:
# provider.delete_connection(
# authorization_id: authorization_id,
# **credentials
# )
nil # Placeholder until provider.delete_connection is implemented
rescue => e
Rails.logger.warn(
"<%= class_name %>ConnectionCleanupJob - API delete failed: #{e.message}"
)
end
<% else -%>
def perform(<%= file_name %>_item_id:, account_id:)
Rails.logger.info(
"<%= class_name %>ConnectionCleanupJob - Cleaning up for former account #{account_id}"
)
<%= file_name %>_item = <%= class_name %>Item.find_by(id: <%= file_name %>_item_id)
return unless <%= file_name %>_item
# For banking providers, cleanup is typically simpler since there's no
# separate authorization concept - the item itself holds the credentials.
# Override this method if your provider needs specific cleanup logic.
Rails.logger.info("<%= class_name %>ConnectionCleanupJob - Cleanup complete for account #{account_id}")View on GitHub (pinned to e69894adb9)
Solutions
- Implement delete_connection(authorization_id:, **credentials) on the provider SDK, or leave the placeholder and accept that connections are only removed locally
- Match the call site to the real SDK signature — the example expects keyword args authorization_id plus splatted credentials
- Verify <%= file_name %>_item.<%= file_name %>_credentials actually returns the credential hash expected by the SDK
- Re-enqueue the cleanup job after fixing to remove the orphaned provider connection
Example fix
# generated connection_cleanup_job.rb - before (TODO placeholder)
# provider.delete_connection(
# authorization_id: authorization_id,
# **credentials
# )
nil # Placeholder
# after
def delete_connection(<%= file_name %>_item, authorization_id)
provider = <%= file_name %>_item.<%= file_name %>_provider
return unless provider
credentials = <%= file_name %>_item.<%= file_name %>_credentials
return unless credentials
provider.delete_connection(
authorization_id: authorization_id,
**credentials
)
rescue => e
Rails.logger.warn("<%= class_name %>ConnectionCleanupJob - API delete failed: #{e.message}")
end Defensive patterns
Strategy: try-catch
Validate before calling
# Resolve SDK pieces explicitly and verify the method exists before calling
provider = <%= file_name %>_item.<%= file_name %>_provider
credentials = <%= file_name %>_item.<%= file_name %>_credentials
if provider.nil? || credentials.nil?
Rails.logger.info("<%= class_name %>ConnectionCleanupJob - nothing to delete (provider or credentials missing)")
return
end
unless provider.respond_to?(:delete_connection)
Rails.logger.warn("<%= class_name %>ConnectionCleanupJob - SDK lacks delete_connection; skipping API delete")
return
end Try / catch
rescue NoMethodError => e
Rails.logger.warn("<%= class_name %>ConnectionCleanupJob - SDK interface missing: #{e.message} - implement delete_connection")
rescue => e
Rails.logger.warn("<%= class_name %>ConnectionCleanupJob - API delete failed: #{e.class} #{e.message}")
end Prevention
- Implement provider.delete_connection in the SDK before uncommenting the TODO call in the generated job
- Use respond_to? checks against the SDK so placeholders degrade gracefully instead of raising
- Track provider-side connection orphans separately from local deletes when the placeholder is left in place
When it happens
Trigger: Uncommenting the example provider.delete_connection(authorization_id:, **credentials) call before that method exists on the provider SDK class; credentials record present but raising on attribute access; provider resolution returning an object without the expected interface (connection_cleanup_job.rb.tt:52 region).
Common situations: Developers scaffolding a new provider with the generator and wiring the TODO incrementally; SDK method renamed or signature changed so **credentials splat raises ArgumentError.
Related errors
- <%= class_name %>ConnectionCleanupJob - Failed: #{e.class} -
- <%= class_name %>ActivitiesFetchJob - Broadcast failed: #{e.
- <%= class_name %> API: #{operation_name} failed (attempt #{r
- <%= class_name %>Item Unlinker: failed to fully unlink provi
- server_error
AI-assisted analysis of we-promise/sure@e69894adb9 (2026-08-21).
Data as JSON: /api/errors/bb7eb20e4c0d050e.
Report an issue: GitHub.