UNDECLARED_NETWORK: Network request to an undeclared origin
| Severity | Fault | Stage |
|---|---|---|
| error | customer (the source package) | build output |
What it means
Section titled “What it means”The component sends a request (fetch, WebSocket, EventSource, sendBeacon, XMLHttpRequest, an RTCPeerConnection) or carries data out through another channel (new Image().src, a <link> element, a form’s action or form.submit(), window.open, location.href = …, location.assign or replace, url() in a style built in code) to an origin its manifest does not declare in permissions.connect, to a relative URL (the host site itself) or to a URL built at run time, whose origin the build cannot check (rule undeclared-network).
How to fix
Section titled “How to fix”Write the URL as a literal that starts with its origin (fetch(“https://api.example.com/items”)) and declare that origin in defineTaggorComponent({ permissions: { connect: [“https://api.example.com”] } }). XMLHttpRequest: use fetch. RTCPeerConnection and form.submit() are never allowed.