contentful/contentful-import

Forbidden for space that I know I have access to

alexkafer opened this issue · 3 comments

Hello,

We're working on duplicating a space. Our thought process is to export the one space and import into a new one using the following config files

export-config.json

{
  "spaceId": "<the source id>",
  "managementToken": "<a personal token for an administrator>"
}

import-config.json

{
  "spaceId": "<the destination id>",
  "managementToken": "<same personal token for an administrator>",
  "contentFile": "data.json"
}

The exporting works just fine. All the data shows up and has no errors.

The importing runs into some forbidden issues:

info import Contentful Import Tool
info import Importing data ...
info Checking if destination space already has any content and retrieving it
info Pushing content to destination space
ERR! import Forbidden: {
ERR! import   "status": 403,
ERR! import   "statusText": "Forbidden",
ERR! import   "message": "You are not authorized to do this action or exceeded your plan limits.",
ERR! import   "details": {},
ERR! import   "request": {
ERR! import     "url": "https://api.contentful.com:443/spaces/<the destination id>/locales",
ERR! import     "headers": {
ERR! import       "Accept": "application/json, text/plain, */*",
ERR! import       "Content-Type": "application/vnd.contentful.management.v1+json",
ERR! import       "X-Contentful-User-Agent": "app contentful.import/4.5.4; sdk contentful-management.js/3.7.6; platform Node.js/6.10.3; os Darwin/0.0.0",
ERR! import       "Authorization": "Bearer ...6ca8e",
ERR! import       "user-agent": "node.js/v6.10.3",
ERR! import       "Accept-Encoding": "gzip",
ERR! import       "Content-Length": 123
ERR! import     },
ERR! import     "method": "post",
ERR! import     "payloadData": "{\"code\":\"fr\",\"name\":\"French\",\"contentManagementApi\":true,\"contentDeliveryApi\":true,\"fallbackCode\":\"en-US\",\"optional\":false}"
ERR! import   },
ERR! import   "requestId": "<a request id>"
ERR! import }
ERR! import     at errorHandler (/usr/local/lib/node_modules/contentful-import/node_modules/contentful-management/dist/contentful-management.node.js:696:15)
ERR! import     at process._tickCallback (internal/process/next_tick.js:109:7)
ERR! import  { Forbidden: {
ERR! import   "status": 403,
ERR! import   "statusText": "Forbidden",
ERR! import   "message": "You are not authorized to do this action or exceeded your plan limits.",
ERR! import   "details": {},
ERR! import   "request": {
ERR! import     "url": "https://api.contentful.com:443/spaces/<the destination id>/locales",
ERR! import     "headers": {
ERR! import       "Accept": "application/json, text/plain, */*",
ERR! import       "Content-Type": "application/vnd.contentful.management.v1+json",
ERR! import       "X-Contentful-User-Agent": "app contentful.import/4.5.4; sdk contentful-management.js/3.7.6; platform Node.js/6.10.3; os Darwin/0.0.0",
ERR! import       "Authorization": "Bearer ...6ca8e",
ERR! import       "user-agent": "node.js/v6.10.3",
ERR! import       "Accept-Encoding": "gzip",
ERR! import       "Content-Length": 123
ERR! import     },
ERR! import     "method": "post",
ERR! import     "payloadData": "{\"code\":\"fr\",\"name\":\"French\",\"contentManagementApi\":true,\"contentDeliveryApi\":true,\"fallbackCode\":\"en-US\",\"optional\":false}"
ERR! import   },
ERR! import   "requestId": "<request id>"
ERR! import }
ERR! import     at errorHandler (/usr/local/lib/node_modules/contentful-import/node_modules/contentful-management/dist/contentful-management.node.js:696:15)
ERR! import     at process._tickCallback (internal/process/next_tick.js:109:7)
ERR! import   stack: 'Forbidden: {\n  "status": 403,\n  "statusText": "Forbidden",\n  "message": "You are not authorized to do this action or exceeded your plan limits.",\n  "details": {},\n  "request": {\n    "url": "https://api.contentful.com:443/spaces/<the destination id>/locales",\n    "headers": {\n      "Accept": "application/json, text/plain, */*",\n      "Content-Type": "application/vnd.contentful.management.v1+json",\n      "X-Contentful-User-Agent": "app contentful.import/4.5.4; sdk contentful-management.js/3.7.6; platform Node.js/6.10.3; os Darwin/0.0.0",\n      "Authorization": "Bearer ...6ca8e",\n      "user-agent": "node.js/v6.10.3",\n      "Accept-Encoding": "gzip",\n      "Content-Length": 123\n    },\n    "method": "post",\n    "payloadData": "{\\"code\\":\\"fr\\",\\"name\\":\\"French\\",\\"contentManagementApi\\":true,\\"contentDeliveryApi\\":true,\\"fallbackCode\\":\\"en-US\\",\\"optional\\":false}"\n  },\n  "requestId": "<request id>"\n}\n    at errorHandler (/usr/local/lib/node_modules/contentful-import/node_modules/contentful-management/dist/contentful-management.node.js:696:15)\n    at process._tickCallback (internal/process/next_tick.js:109:7)',
ERR! import   name: 'Forbidden',
ERR! import   message: '{\n  "status": 403,\n  "statusText": "Forbidden",\n  "message": "You are not authorized to do this action or exceeded your plan limits.",\n  "details": {},\n  "request": {\n    "url": "https://api.contentful.com:443/spaces/<the destination id>/locales",\n    "headers": {\n      "Accept": "application/json, text/plain, */*",\n      "Content-Type": "application/vnd.contentful.management.v1+json",\n      "X-Contentful-User-Agent": "app contentful.import/4.5.4; sdk contentful-management.js/3.7.6; platform Node.js/6.10.3; os Darwin/0.0.0",\n      "Authorization": "Bearer ...6ca8e",\n      "user-agent": "node.js/v6.10.3",\n      "Accept-Encoding": "gzip",\n      "Content-Length": 123\n    },\n    "method": "post",\n    "payloadData": "{\\"code\\":\\"fr\\",\\"name\\":\\"French\\",\\"contentManagementApi\\":true,\\"contentDeliveryApi\\":true,\\"fallbackCode\\":\\"en-US\\",\\"optional\\":false}"\n  },\n  "requestId": "<request id>"\n}' }

I've removed various IDs from the code above, shown with <>
Any ideas?

Looks like you reached your locale limit. Try to delete unused locales in the space you are importing to :)

Edit: Might also that the maximum number of locales in your whole organization is reached.

We only have one locale right now in our importing space, with the plan supporting up to 20. Is this something I should be talking to Contentful support about?

locales

Ah, figured it out. While there was only one locale in the importing space, we have two spaces on our plan and the other one (the export) was maxed out at 20.

I now know the issue, thanks @axe312ger for your assistance!