Skip to content

Add default API URL fallback (vertex app) - #3586

Merged
Baalmart merged 3 commits into
stagingfrom
ft-vertex-template
Jun 7, 2026
Merged

Add default API URL fallback (vertex app)#3586
Baalmart merged 3 commits into
stagingfrom
ft-vertex-template

Conversation

@Codebmk

@Codebmk Codebmk commented Jun 7, 2026

Copy link
Copy Markdown
Member

Summary of Changes (What does this PR do?)

  • Introduce getDefaultApiUrl() in envConstants to provide environment-aware default API endpoints (production, staging, localhost). Change getApiBaseUrl() to fall back to this default instead of throwing when NEXT_PUBLIC_API_URL is missing. Update vertex.config to import and use getDefaultApiUrl() for api.baseUrl and publicMeasurementsBaseUrl, ensuring the app has sensible defaults across environments.

Status of maturity (all need to be checked before merging):

  • I've tested this locally
  • I consider this code done
  • This change ready to hit production in its current state
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included issue number in the "Closes #ISSUE-NUMBER" part of the "What are the relevant tickets?" section to link the issue.
  • I've updated corresponding documentation for the changes in this PR.
  • I have written unit and/or e2e tests for my change(s).

How should this be manually tested?

  • Please include the steps to be done inorder to setup and test this PR.

What are the relevant tickets?

Screenshots (optional)

Summary by CodeRabbit

  • Bug Fixes
    • Application now gracefully handles missing API configuration by automatically selecting appropriate defaults based on the current environment.

Introduce getDefaultApiUrl() in envConstants to provide environment-aware default API endpoints (production, staging, localhost). Change getApiBaseUrl() to fall back to this default instead of throwing when NEXT_PUBLIC_API_URL is missing. Update vertex.config to import and use getDefaultApiUrl() for api.baseUrl and publicMeasurementsBaseUrl, ensuring the app has sensible defaults across environments.
@Codebmk
Codebmk requested a review from Baalmart June 7, 2026 15:50
@Codebmk Codebmk self-assigned this Jun 7, 2026
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Codebmk, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 34 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c4d8830b-2741-4e86-a645-2fbd0ecd7c55

📥 Commits

Reviewing files that changed from the base of the PR and between dc61993 and 755d22d.

📒 Files selected for processing (2)
  • src/vertex/lib/envConstants.ts
  • src/vertex/vertex.config.ts
📝 Walkthrough

Walkthrough

API URL resolution now respects environment variables (NEXT_PUBLIC_API_URL, NEXT_PUBLIC_API_BASE_URL) with environment-aware fallbacks (production/staging/localhost) instead of hardcoded defaults or throwing errors.

Changes

Environment-based API URL Configuration

Layer / File(s) Summary
Default API URL fallback logic
src/vertex/lib/envConstants.ts
New getDefaultApiUrl() function selects an API base URL by environment. Updated getApiBaseUrl() reads NEXT_PUBLIC_API_URL with fallback to the new helper, eliminating the previous error-throwing behavior when the env var is absent.
Config integration with environment-aware URLs
src/vertex/vertex.config.ts
Vertex configuration imports getDefaultApiUrl and derives both api.baseUrl and api.publicMeasurementsBaseUrl from environment variables, falling back to the environment-aware helper instead of a hardcoded production URL.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🌍 From hardcoded URLs to the sky so blue,
Environment whispers what the system should do,
Production, staging, localhost in line,
No more throwing errors—just fallbacks divine! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add default API URL fallback (vertex app)' directly and clearly summarizes the main changes: adding a default API URL fallback mechanism for the Vertex app.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ft-vertex-template

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/vertex/lib/envConstants.ts`:
- Line 23: The validateEnvironment() required-vars list is inconsistent with
getApiBaseUrl()/getDefaultApiUrl(): remove NEXT_PUBLIC_API_URL from the required
variables in validateEnvironment() so that the validator matches the runtime
fallback; update validateEnvironment() to no longer include
"NEXT_PUBLIC_API_URL" while leaving other required env names untouched and keep
getApiBaseUrl() and getDefaultApiUrl() behavior unchanged.

In `@src/vertex/vertex.config.ts`:
- Line 7: Add a type import for VertexConfigInput at the top of
src/vertex/vertex.config.ts and use it for the config variable (or remove the
explicit annotation); specifically import the exported type symbol
VertexConfigInput from ./core/config/vertex-config (e.g. using an `import type {
VertexConfigInput } from "./core/config/vertex-config"` statement) so the `const
config: VertexConfigInput = { ... }` declaration is valid.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 917bad93-f0fe-48e7-9d92-1b63e8a0e798

📥 Commits

Reviewing files that changed from the base of the PR and between 7d98273 and dc61993.

📒 Files selected for processing (2)
  • src/vertex/lib/envConstants.ts
  • src/vertex/vertex.config.ts

Comment thread src/vertex/lib/envConstants.ts
Comment thread src/vertex/vertex.config.ts
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

New azure vertex changes available for preview here

1 similar comment
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

New azure vertex changes available for preview here

@Baalmart
Baalmart merged commit c84b816 into staging Jun 7, 2026
28 checks passed
@Baalmart
Baalmart deleted the ft-vertex-template branch June 7, 2026 16:53
@Baalmart Baalmart mentioned this pull request Jun 7, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants