next-auth: Github Provider: expected 200 OK with body but no body was returned
Provider type
GitHub
Environment
System:
OS: macOS 13.1
CPU: (8) arm64 Apple M1
Memory: 98.83 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
Watchman: 2023.02.06.00 - /opt/homebrew/bin/watchman
Browsers:
Brave Browser: 110.1.48.158
Chrome: 109.0.5414.119
Firefox: 92.0
Safari: 16.2
Reproduction URL
https://github.com/sbmsr/github-issue-example
Describe the issue
When authenticating with GitHub, I see the following error:

And the server logs show the following:
2023-02-10T22:19:39.605Z d88b50e3-3f8d-4941-856a-dcaf0ff3bc8e ERROR [next-auth][error][OAUTH_CALLBACK_ERROR]
https://next-auth.js.org/errors#oauth_callback_error expected 200 OK with body but no body was returned {
error: OPError: expected 200 OK with body but no body was returned
at processResponse (/var/task/node_modules/.pnpm/openid-client@5.4.0/node_modules/openid-client/lib/helpers/process_response.js:56:11)
at Client.grant (/var/task/node_modules/.pnpm/openid-client@5.4.0/node_modules/openid-client/lib/client.js:1327:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.oauthCallback (/var/task/node_modules/.pnpm/openid-client@5.4.0/node_modules/openid-client/lib/client.js:603:24)
at async oAuthCallback (/var/task/node_modules/.pnpm/next-auth@4.19.2_phzvn2nhb6zk7o4ds4z4gvqlei/node_modules/next-auth/core/lib/oauth/callback.js:131:16)
at async Object.callback (/var/task/node_modules/.pnpm/next-auth@4.19.2_phzvn2nhb6zk7o4ds4z4gvqlei/node_modules/next-auth/core/routes/callback.js:52:11)
at async AuthHandler (/var/task/node_modules/.pnpm/next-auth@4.19.2_phzvn2nhb6zk7o4ds4z4gvqlei/node_modules/next-auth/core/index.js:201:28)
at async NextAuthHandler (/var/task/node_modules/.pnpm/next-auth@4.19.2_phzvn2nhb6zk7o4ds4z4gvqlei/node_modules/next-auth/next/index.js:24:19)
at async /var/task/node_modules/.pnpm/next-auth@4.19.2_phzvn2nhb6zk7o4ds4z4gvqlei/node_modules/next-auth/next/index.js:60:32
at async Object.apiResolver (/var/task/node_modules/.pnpm/next@13.1.6_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/api-utils/node.js:372:9) {
name: 'OAuthCallbackError',
code: undefined
},
providerId: 'github',
message: 'expected 200 OK with body but no body was returned'
}
I have a public repo as well as a running vercel app (same code as repo).
How to reproduce
Set up your […nextAuth].ts like so:
import NextAuth, { NextAuthOptions } from "next-auth";
import GithubProvider from "next-auth/providers/github";
export const authOptions: NextAuthOptions = {
providers: [
GithubProvider({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
}),
],
theme: {
colorScheme: "light",
},
callbacks: {
async jwt({ token }) {
token.userRole = "admin";
return token;
},
},
};
export default NextAuth(authOptions);
Expected behavior
Upon clicking login, it should auth with GitHub and redirect to the home page of the example app, with the user details visible in the nav.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 9
- Comments: 23 (2 by maintainers)
Hi everyone,
My name is Swarnava and I work on Vercel Customer Success team. We are investigating this issue now.
Hi,
We reverted a change that we believe should fix the problem. Please redeploy your app, and let us know If you are still facing this issue: https://vercel.com/help
Same issue here on Vercel with Google auth provider.
I’m also running into this issue with Google and LinkedIn in production and staging on Vercel, I wonder what could have changed to cause this. This is working locally for me. I’ve triple check client ids/secrets and redirect uris. Nothing has changed in my code over the last few days.
Sent in an urgent support request and Tweeted at the team, hopefully we can get this figure out soon: https://twitter.com/zlwaterfield/status/1624215198339854336
I’ve opened an issue on the vercel community github discussion board. Hopefully we can get a response soon.
I moved everything to Netlify and it works It seems to be an issue with Vercel I’ll be paying for both for now
NOTE: Netlify function timeouts are 10secs so if you need the Vercel 1min timeout then that work around will not suffice…
Thank you @swarnava and everyone for following, I can also confirm that redeploying fixes the issue. I’m closing this issue.
I tryed netlify but is giving me same thing, with the google provider
@chelsea-tnc not yet. We are still investigating this. We recommend creating a ticket using https://vercel.com/help for specific help, but in the meantime, we will update this thread.
Instant Rollback to a deploy from yesterday works.
Github for me fails with an
OAuthCallback
and Google fails with aOAuthSignin
. Is there a provider that’s immune to this?I’m getting the exact same server log but with Facebook. Only in production.