-
Notifications
You must be signed in to change notification settings - Fork 386
Closed
Labels
Description
- Review the documentation: https://clerk.com/docs
- Search for existing issues: https://github.com/clerkinc/javascript/issues
- Go through package changelog files.
- Provide the Frontend API key from your application dashboard.
Package + Version
-
@clerk/nextjs
Dependencies + versions
"dependencies": {
"@clerk/nextjs": "^4.20.0",
"next": "^13.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
}
Description
Hey folks,
My application has a typeahead component which makes requests to an internal /api/places
endpoint as the user types.
async function enterSearch(query: string) {
await fetch(`/api/places?searchInput=${query}`, {
method: 'GET'
});
}
}
This is just a simplified example, the actual component has debounce controls etc to manage requests, none the less there is a common issue caused by clerk where by my middleware throws the following error:
-- Options debug, {
"debug": true,
"beforeAuth": false,
"afterAuth": false
}
-- authenticateRequest state is interstitial in an API route, {
"status": "interstitial",
"reason": "token-expired",
"message": "JWT is expired. etc...",
"frontendApi": "<frontend-api>",
"publishableKey": "<key>",
"isSatellite": false,
"domain": "",
"proxyUrl": "",
"signInUrl": "/sign-in",
"isSignedIn": false,
"isInterstitial": true,
"isUnknown": false
}
It seems that the application only recovers from this state when I prevent typing again for about 30-60 seconds. I've tried marking the api endpoint as a public route, ignored route etc but the only way to prevent this error thus far has been to remove the middleware. I was unable to find any documentation about this state or behaviour so would appreciate a steer.
Many thanks,
KD
danilofuchs