How to call netlify serverless function from a chrome extension?

I am building a chrome extension that uses the bookmarks chrome browser api to ingest, you guessed it, bookmarks. Problem is the webpage is being run locally (the files are packaged in the extension and run locally in browser) and not from the hosted app (https://bookmark-previewer.netlify.app). The user navigates their browser to chrome://bookmarks and the webpage is rendered.

Now the GET requests complete successfully when calling from the hosted site but not from chrome://bookmarks.

An example request from browser is chrome-extension://inlgifdbnfljkaejplmbjeaghbdcjngo/api/fetchOpenGraphData?url=https://google.com. Dont worry about the /api/ part, I have a redirect in my .toml file to the correct location. I dont know how/why inlgifdbnfljkaejplmbjeaghbdcjngo is injected in there thou…

*Note I am using the chrome_url_overrides feature of chrome extensions if that helps.

Any suggestion is appreciated :slight_smile:

I am building a chrome extension that uses the bookmarks chrome browser api to ingest, you guessed it, bookmarks. Problem is the webpage is being run locally (the files are packaged in the extension and run locally in browser) and not from the hosted app (https://bookmark-previewer.netlify.app.

So this question seems to be more about Google Chrome Extension development than Netlify Functions. Unfortunately, troubleshooting this custom code falls outside of the support we provide. I can point you in the right direction with calling the Netlify Function though!

You can call your function by following the endpoint, relative to the base URL of your site: /.netlify/functions/hello.

… requests complete successfully when calling from the hosted site but not from chrome://bookmarks.

As far as I can tell, this post may help with that:

You may want to visit a chrome extension development forum for further assistance with creating a self-hosted chrome extension.