Skip to content

fix(integrations): unwrap CRM success_response envelope when fetching credentials#25

Closed
gomessguii wants to merge 2 commits into
developfrom
guilhermegomes/fix-integration-credentials-envelope
Closed

fix(integrations): unwrap CRM success_response envelope when fetching credentials#25
gomessguii wants to merge 2 commits into
developfrom
guilhermegomes/fix-integration-credentials-envelope

Conversation

@gomessguii

@gomessguii gomessguii commented Jul 11, 2026

Copy link
Copy Markdown
Member

@/tmp/claude-1000/-home-guilherme-evolution-evocloud-evo-crm-community/2e0cd245-fd9d-4440-ab4d-b1a1bbea22db/scratchpad/pr-proc-body2.md

… credentials

GlobalConfigService fetched OAuth credentials from the CRM's service endpoints
(/api/v1/integrations/{provider}/credentials) and read the fields at the top
level of the JSON body. But those endpoints inherit Api::ServiceController and
wrap the payload as {"success": true, "data": {...}, "meta": ...}. So every
credential lookup read None for client_id/client_secret/redirect_uri even when
configured — the provider connect flow then failed (e.g. Google Calendar agent
authorization returned 500 "Missing credentials").

Read the fields from the `data` envelope instead, across all 13 provider
credential fetches (google_calendar, google_sheets, github, notion, stripe,
monday, atlassian, asana, hubspot, linear, paypal, canva, supabase).

_fetch_all_config (/global_config) is unchanged — that endpoint returns fields
at the top level (no envelope) and was already correct.

Verified: parsing the real staging /integrations/google_calendar/credentials
response now yields client_id/client_secret (redirect_uri still requires
GOOGLE_CALENDAR_REDIRECT_URI to be configured in the CRM global config).

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @gomessguii, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

…s MM/DD)

The agent's injected 'Current datetime' system-data (and the {current_datetime}
template var) used %d/%m/%Y, so an LLM read e.g. 11/07/2026 as MM/DD -> Nov 7
instead of Jul 11, scheduling calendar events on the wrong date. Emit ISO 8601
(YYYY-MM-DD HH:MM), plus the weekday in the system-data block, so day/month
order is unambiguous.
@gomessguii

Copy link
Copy Markdown
Member Author

Fechando — superseded pela #28, que já trouxe o unwrap do envelope (+ tenant + redirect_uri) pra develop.

@gomessguii gomessguii closed this Jul 11, 2026
@gomessguii
gomessguii deleted the guilhermegomes/fix-integration-credentials-envelope branch July 11, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant