Help

Using fetch() in a scripting extension

Topic Labels: Automations Extensions
Solved
Jump to Solution
860 2
cancel
Showing results for 
Search instead for 
Did you mean: 
MrLuke
6 - Interface Innovator
6 - Interface Innovator

Hello

I've creating a function to act as a rudimentary web scraper to grab some meta data like the page title, description etc using the `fetch()` api. 

In an automation, this works perfectly as expected. But in a scripting extension, my `try...catch` throws an error message of "Failed to fetch".

Are there some restrictions/limitations between automation scripts and extension scripts when it comes to using `fetch()` ?

1 Solution

Accepted Solutions
AlliAlosa
10 - Mercury
10 - Mercury

In the extension, try replacing "fetch()" with "remoteFetchAsync()". This method only works in extension scripts whereas "fetch" works in automation scripts.

 

See Solution in Thread

2 Replies 2
AlliAlosa
10 - Mercury
10 - Mercury

In the extension, try replacing "fetch()" with "remoteFetchAsync()". This method only works in extension scripts whereas "fetch" works in automation scripts.

 

Thanks that's fixed it! So simple 🤦