-
Notifications
You must be signed in to change notification settings - Fork 295
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
Next.JS Error in withClerkMiddleware.js #840
Comments
Hello @matteobad , thank you for reporting. Let me take a look and get back to you. |
This seems to be the same case as vercel/next.js#44780 (comment) |
Right now the error is present on every page. I'm using tRPC to call my backend but this doesn't seem to be the problem because I get the same error if I try to create a new Page with nothing in it like this one: export default function TestPage {
return (
<>
<Head>
<title>Create T3 App</title>
<meta name="description" content="Generated by create-t3-app" />
<link rel="icon" href="/favicon.ico" />
</Head>
Budget
</>
);
}; And this is the content of my import { withClerkMiddleware } from "@clerk/nextjs/server";
import { NextResponse } from "next/server";
import type { NextRequest } from 'next/server'
export default withClerkMiddleware((req: NextRequest) => {
return NextResponse.next();
});
// Stop Middleware running on static files
export const config = { matcher: '/(.*?trpc.*?|(?!static|.*\\..*|_next|favicon.ico).*)',}; |
We are setting some headers when it's unclear if the user is authenticated to access the server for debug purposes. The issue is related to the encoding of the header value which can only contain |
Encoding error caused by non latin1 (ISO-8859-1) value in headers: Cannot convert argument to a ByteString because the character atindex {} has a value of {} which is greater than 255. #840
Hi @dimkl, I just saw your PR which should solve my problem (I'll try later). I also tried to debug the middleware to give more information on the above error: The error is related to the The error seems to be at index 116 where the: |
Encoding error caused by non latin1 (ISO-8859-1) value in headers: Cannot convert argument to a ByteString because the character atindex {} has a value of {} which is greater than 255. #840
Fixed is deployed in the latest release! |
Package + Version
@clerk/clerk-js
@clerk/clerk-react
@clerk/nextjs
@clerk/remix
@clerk/types
@clerk/themes
@clerk/localizations
@clerk/clerk-expo
@clerk/backend
@clerk/clerk-sdk-node
@clerk/shared
@clerk/fastify
gatsby-plugin-clerk
build/tooling/chore
Version:
Browser/OS
If applicable e.g.
Chrome latest
Description
Hello, I'm running a turborepo based on https://github.com/clerkinc/t3-turbo-and-clerk/, a T3 Stack with Clerk instead on Next-Auth. Everything works fine except for one error that gets triggered apparently randomly in the middleware.
I'm using Next.JS version
13.1.6
with the samemiddleware.ts
of the example repo and I get the following error:If I understand correctly it seems that the middleware is trying to set some additional headers in the response but failing to do so, because of conversion. As I said my middleware is just using the
withClerkMiddleware
without any custom logic. How can I fix it or debug it further to provide more info?Thank you in advance and keep up the great work!
The text was updated successfully, but these errors were encountered: