Fetch API does not work for me


according to this site it should be possible to use api.fetch(url, options ) for external calls.

I’m building a custom ui app and I need get a file. I tried it int App.JS from in static content and index.js but both run into the same error: Uncaught TypeError: Cannot read property ‘fetch’ of undefined
at Object.t.wrapFetchApiMethods (index.js:8)


Hi @hansemarco,

At the moment in a custom UI app, you need to make external calls via a resolver function. See custom ui resolver. Here is where you’ll use @forge/api and make your fetch call.

You’ll invoke the resolver via the @forge/bridge which will receive whatever data your resolver function returns.

Hope that helps!

Thanks, now it works.

1 Like