contentful / contentful-export

This tool allows you to export a Contentful space to a JSON dump
MIT License
163 stars 74 forks source link

Proxy options get removed in cda client #1821

Open rustyy opened 4 months ago

rustyy commented 4 months ago

Issue

With the option deliveryToken only published entries are supposed to be exported.

This fails if the request is executed behind a proxy. The following code will fail:

import contentful from "contentful-export";

const options = {
    spaceId: "<space-id>",
    managementToken: "<my-cma-token",
    deliveryToken: "<my-delivery-token>",
}

contentful(options)
    .then((result:any) => {
        // ...
    })
    .catch((err:any) => {
        // A request fails if deliveryToken is given and a request is executed behind a proxy
    })

In the index.js the CDA-client is created via initClient(...).

cf-export-index

The initClient function is not aware of all options given and remove possible proxy options passed in by the consumer.

cf-export-init-client

In result the contentful-export fails if used behind a proxy.

Expected behavior

Given proxy-settings should be taken into account if passed in by the consumer together with the deliveryToken.

david-shibley-contentful commented 3 months ago

@rustyy Thank you for bringing this to our attention. I agree we should be doing this. I added an item to our backlog to address this but I don't have a current estimate of when we will get to it

rustyy commented 3 weeks ago

@david-shibley-contentful any update on this?

maybe worth mentioning - also the "host" option is not taken into account, which is required in case of different datacenters (us vs eu). Without this, it is not possible to export the according entities as requests against the CDA will fail for EU datacenter.