Problem with Strapi / Next Iron Session and User object size

System Information
  • Strapi Version: 3.6.5
  • Operating System: Pop OS
  • Database: MongoDb
  • Node Version: 14.17.0
  • NPM Version: 6.14.13
  • Yarn Version: 1.22.10

Hi !

First of all, thanks to the team and the community for this excellent work!

I am contacting you today because I have a problem with the integration of Strapi authentication with NextJS.

I followed this rather recent tutorial with Next Iron Session: Implementing Strapi authentication in NextJS - DEV Community

In my collections, I have created several collections related to my user.
When I login to an account without content, everything is fine.

However, when the user has content, it is returned at login time and this prevents Next Iron Session from setting the cookie because the content is too big.

So I wondered if there was an option somewhere for the login function to return only the user’s information, without the related collections.
Has anyone encountered this problem before? Is there a solution or a workaround?

Thank you in advance for your response.

I think you can achieve this by fetching user data without any relation with Strapi 4 rest API populate and field selection. Or with Strapi 3 you can customize your backend, creating a new API route or modify the existing user route to return less data.

1 Like