Can´t use Fetch in my extension

Hey I can´t use fetch to acces to my external API. My Code:

const url = "API LINK";

const options = {

method : "GET",

headers: {

    'Content-Type': 'application/json'



fetch(url, options)

.then( res => res.json() )

.then( data => {


} );

What is the error returned?
You’ll likely find this in the browser inspector console or network tools

Common issues are the lack of CORS headers on your API endpoint.
And if in hosted test you didn’t add your domain name to the permitted domains list in the dev console.

the error is: “because it violates the document’s Content Security Policy.”

This suggests you are in hosted test and the CSP is being applied.

And thus the API Link is not in the CSP rules for your extension.


1 Like