fix(crm): resolve the CRM install URL at runtime - #288
Merged
Conversation
The Connect button built its URL from import.meta.env.VITE_API_URL, which is baked at build time and so never sees a self-hoster's window.APP_CONFIG. The browser left for the wrong host — carrying no session cookie — and the install died on "Not authenticated". Every sibling helper already used getApiUrl(). Adds a spec covering both CRM providers and the Slack install URL, so the whole class of browser-navigation URL is guarded rather than just the one that broke. Fixes #287 Signed-off-by: chattermate <admin@chattermate.chat>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #287.
Connect on Pipedrive/HubSpot built its URL from
import.meta.env.VITE_API_URL, which is baked at build time and never sees a self-hoster'swindow.APP_CONFIG. The browser left for the wrong host with no session cookie and gotNot authenticated. Slack's install URL and the axios client already usedgetApiUrl()— this was the one spot that missed it.Note: our images don't pass
VITE_API_URLas a build arg, so in a repo-built image it'sundefined, not the SaaS URL the reporter saw. Same fix either way.The spec covers both CRM providers and Slack, so the class is guarded rather than the single line. Reverting the fix fails 7 of 10.
Two follow-ups left out to keep this tight:
ShopifyAgentManagementView.vuehas the same bug for avatar URLs (enterprise submodule, currently on an in-progress branch), and an ESLint rule could banimport.meta.env.VITE_API_URLoutsideconfig/api.ts.