https://supertokens.com/ logo
#support-questions
Title
# support-questions
g

gusfune

07/22/2021, 6:01 AM
Hey, could use some help with a very edgy case we have here. Because of RBAC we have a generic way to fetch GQL data in NextJS that's used in both API endpoints and GetServerSideProps. We are having a few issues regarding
ERR_HEADERS ALREADY SENT
and we figured the cultprit was our session refresher in this session, as it was refreshing the session and still trying to send the data back to the user. We were using
supertokens.errorHandler()(error, req, res, () => ({}))
in the function for this. If we remove this, the already sent errors are gone, but if an user is logged for too long , the session refresh will cause some collateral effects (require a page refresh), but still, it's not nice. Any idea how we can refresh the session or if we should just drop the request if it's a refresher?