Skip to content

[v4] API token get invalidated seemingly at random #12255

@ovlb

Description

@ovlb

Bug report

Describe the bug

We have a Strapi instance running on Digital Ocean. We use the API from it to deploy a site on Netlify.

When creating an API key, the first build always succeeds. After that it gets weird. We had some tokens which worked for two or three deploys, another one which worked for around 24 hours. The last two were returning 401 errors after the first deploy.

Here’s what we ruled out so far:

  1. Rate limiting. I created a token last night, but the forst deploy this morning (~9 hours after last deploy and token creation was failing). And we had a token working for almost a day where we sometimes multiple deploys in ~90 seconds were working correctly.
  2. [v4] npm install does not work with npm 8.3.0 #12232. I downgraded Node to v14 and NPM to v6 yesterday, and the problem is still creeping up.
  3. Config errors. We use the netlify.toml file to store the API key, which does not change. And we can reproduce the error in Paw/Postman when using the key

The problem did not show up during local development but only since we use the «proper» deploy with DO/Netlify.

For now, we’ve changed the access permissions for the necessary post types to be public, as we must publish the prod site this evening. But that’s obviously not a long term solution.

Is there any config we might have missed?

Steps to reproduce the behavior

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

An API key should work.

System

  • Node.js version: v14/v16
  • NPM version: v6/v8
  • Strapi version: v4.0.4/v4.0.5
  • Database: Postgres 12
  • Operating system: Ubuntu

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundsource: core:strapiSource is core/strapi packagestatus: confirmedConfirmed by a Strapi Team member or multiple community members

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions