Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading SpaceAccessError shown during failed request (Response size too big) #932

Open
yan-kisen opened this issue Oct 20, 2021 · 5 comments

Comments

@yan-kisen
Copy link

Migration script throws a SpaceAccessError for all Request errors.

The provided space does not exist or you do not have access.

One of my ContentTypes was returning a Response size too big error during the migration-parser initialization.

let existingEntries: APIEntry[]
try {
existingEntries = await fetcher.getEntriesInIntents(intentList)
} catch (error) {
throw new errors.SpaceAccessError()
}

After a lot of head scratching, the root cause was finally identified as coming from this response

{
  "sys": {
    "type": "Error",
    "id": "BadRequest"
  },
  "message": "Response size too big. Maximum allowed response size: 7340032B.",
  "requestId": "9be0607d-fabc-4c6c-8cfb-99234ea45eec"
}

Expected Behavior

Provide more accurate exception information. (Pass the caught error upstream)

Workaround

In my case, I was able to get it to work by modifying the requestBatchSize argument

--requestBatchSize=50
@PierreCavalet
Copy link

Got the same error, I had to dive in the code to find what was happening. I used the same fix in a migration node script if anyone needs this outside of the CLI:

const options = {
  migrationFunction: '...',
  spaceId: '...',
  accessToken: '...',
  environmentId: 'env',

  requestBatchSize: 50
}

await runMigration(options)

Would be really nice to have a better error message.

@tharders
Copy link

Same for me.

This really should be improved, since it took me a while to find the real problem by digging into the code.

It would be really cool, when there would be an automatic retry with a reduced batch size when the Response size to big error is hit.
Unfortunately the status code is a normal 400 Bad Request. With that you would have to check the error message to find out that the response size would be too big. Maybe the API can also be improved to make such things easier.

@gigaSproule
Copy link

Just for anyone else who ends up here, I got this same error, but for something completely different. It seems like this error maybe a common output from multiple different errors when it's trying to interact with Contentful.

In my use case, it was trying to find a content entry that didn't exist.

@jalandis
Copy link

jalandis commented Jul 8, 2024

I just ran into the issue SpaceAccessError and spent some time troubleshooting to find the real reason was Response size too big. Maximum allowed response size: 7340032B.. Just documenting to give this issue a bump for the next user.

@backflip
Copy link

I ran into the same issue when the actual error turned out to be a 404 The resource could not be found..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants