Skip to content

Fix MCP server Runtime page crash when an endpoint is removed#1371

Open
Saadha123 wants to merge 2 commits into
wso2:mainfrom
Saadha123:fix/mcp-runtime-missing-endpoint-crash
Open

Fix MCP server Runtime page crash when an endpoint is removed#1371
Saadha123 wants to merge 2 commits into
wso2:mainfrom
Saadha123:fix/mcp-runtime-missing-endpoint-crash

Conversation

@Saadha123

@Saadha123 Saadha123 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Purpose

Fixes the crash that occurs when navigating to the Runtime page of an MCP server after deleting either the production or sandbox endpoint.

Changes

  • The Runtime page threw TypeError: Cannot read properties of undefined (reading 'url') because showEndpoint() in Endpoints.jsx accessed .url directly on
    endpointConfig.production_endpoints / endpointConfig.sandbox_endpoints without checking if the object exists.
  • Added null guards so that a missing endpoint returns undefined instead of throwing, which the existing JSX already handles by rendering a blank placeholder (-).
image

Related Issues

Fixes wso2/api-manager#5096

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

In Endpoints.jsx, the showEndpoint function is updated to guard against absent production_endpoints or sandbox_endpoints objects within endpointConfig before accessing .url, preventing a TypeError when either endpoint sub-object is undefined.

Changes

Null-safe endpoint URL access

Layer / File(s) Summary
Null-guard in showEndpoint
portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/components/Endpoints.jsx
The production and sandbox branches now use && to check for the existence of production_endpoints / sandbox_endpoints before reading .url, returning a falsy value instead of throwing when either sub-object is missing.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main fix: preventing a crash on the Runtime page when an endpoint is removed, which matches the core changeset.
Linked Issues check ✅ Passed The PR successfully addresses issue #5096 by adding null guards to prevent TypeError when accessing .url on missing endpoint objects, preventing the Runtime page crash.
Out of Scope Changes check ✅ Passed All changes are confined to the showEndpoint() function in Endpoints.jsx and directly address the null guard requirement for handling missing endpoints, with no out-of-scope modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The pull request description clearly explains the bug being fixed, the root cause (missing null checks), and the solution implemented.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 22, 2026
@sonarqubecloud

Copy link
Copy Markdown

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.

Runtime View Fails When Sandbox or Production Endpoint Is Removed in MCP server

2 participants