chrome.proxy Is Unavailable to Ordinary Webpage Scripts
The proxy permission does not make privileged extension APIs appear in an ordinary web page or every script context.
Adding "proxy" to an extension's permissions does not turn a website's JavaScript into extension code.
Check where the failing statement actually runs. A normal page, an injected page script, a content script, and an extension-owned page or service worker have different API access. A page reload is not a reliable way to identify that boundary.
Place the privileged proxy operation in a supported extension context and communicate through the extension's documented messaging mechanism where needed. The extension still needs the appropriate permission.
Keep that operation narrowly scoped. A content script should not relay arbitrary requests from any website to reconfigure the browser's proxy without the extension's own validation and user-facing purpose.
If the API exists but the setting does not take effect, that is another problem: inspect asynchronous errors, scope, and effective control. An undefined API object points first to availability and execution context, not to whether the remote proxy IP accepts connections.