Using network

Enhance your exporters with network capabilities - securely.

Because of the security reasons, the exporters run in an encapsulated, hardened sandbox that is unable to communicate with the outside world by any means (read more here).

However, we still realize the value of having exporters be able to reach the network, so we built an alternative for native typescript features like web fetch or node node-fetch.

While you can't use those libraries directly (using fetch will result in fetch undeclared in the runtime, you can still use that capability through the SDK.

Using network through SDK

To enable networking functionality, the SDK exposes a secure fetch instance that you can access. This fetch is based on node-fetch library and as such you can use it completely the same as you would with regular fetch. To access the networking capabilities, simply use the provided sdk instance from the Pulsar main export function and access the networking interface:

                                                            const response = await, options)

You can also use the following code to handle the fetch properly:

                                                          async performFetch(sdk: Supernova, url: string, options?: RequestInit): Promise<Response> {
                                                            try {
                                                              const response = await, options)
                                                              if (!response.ok) {
                                                                throw new Error(`Request failed with status ${response.status}, error: ${await response.text()}`)
                                                              return response
                                                            } catch (error) {
                                                              throw error

Finally, we have built helpers so you don't have to worry about error handling at all. You can find all network helper methods here. The helpers are focused on the most common export scenarios, like downloading JSON, text or data from the network.

POST, PUT requests are still possible, but we haven't provided any helpers for this particular task as the exporters don't require this kind of capability.