[update] we realized the issue is caused by the fetch behavior changes in recent deployments.
original post
During the recent deployment, We found some issues with the Vercel middleware code. we used jose library’s jwtDecode to decode a JWT token and it raised an error [Gt: JWTs must use Compact JWS serialization, JWT must be a string]. however, it didn’t happen even for the same code that was deployed before last Friday. I wanna know why this error was raised, didn’t Vercel change the runtime for middleware recently?
Hi dear @anshumanb thanks for your reply. we have some new findings regarding this issue. it looks like the root cause of this issue is actually because we called a fetch in a middleware before using jose to decodeJwt, however, the result of the fetch returns a error saying the requirement params not passing correctly.
Hi @jingxu, thanks for providing more details. It seems like the API you are calling might have changed their request parameters. Have you confirmed that the API hasn’t changed?
Hi @anshumanb No, the API hasn’t changed in our case. It also works in the local development environment with the same source code. I noticed the behavior of fetch API in the middleware changed in the new deployment for posting data with data as FormData object.
We did some captures on the server side. and have more information
the following are some screenshots between local dev server and remote deployment