Closed xedro98 closed 1 year ago
@xedro98 hope you have followed the instructions on this page to create a GitHub id and secret. if your running this locally, make sure you add a home page url and Authorization callback URL to http://localhost:3000/
Get the same issue.
However, the UI is still in logged out mode. When sending a chat message, a 401 error is returned.
Check if KV datastore are workin, check env of KV.
How do I setup the github login? I followed the intruction byt when i click login and authorize my github account, the chat UI just regreshes and still shows Login option, when I click Login again, it just refreshes the page.
same to me
How do I setup the github login? I followed the intruction byt when i click login and authorize my github account, the chat UI just regreshes and still shows Login option, when I click Login again, it just refreshes the page.
same to me
same to me. And I've used the same callback URL - ".../api/auth/callback/github"
here is my environment variables. 401 error on chat api received. The login api is working, but the header is blank.only the login button appears
Same here, investigating why that not work on prod. Local works fine. All fine without auth errors but get 401 if send chat conversation.
I see that i get my user:
But then is like refresh page. I see cookies on Browser.
same problem +1
Same here, investigating why that not work on prod. Local works fine. All fine without auth errors but get 401 if send chat conversation.
Same for me
All fine without auth errors but get 401 if send chat conversation.
For some reason, an Openai key in the .env file has been reset. Setting it up again resolved the issue
I don’t have issue with OpenAI , Th error is with Auth, on Prod not works only locally.
This happens because the app check Auth before send request. I don’t see my GitHub username after logging.
I have the same issue :(
same problem
+1 same problem on prod deployment, works fine on local
I got it working locally, but I can't make it work when I deploy it on vercel... weird
Same issue here, sign-in works fine locally but not in prod on vercel. When signing in it sets the cookie for the session (also tried with Google) but it doesn't sign-in. The edge function returns 200 in the Vercel logs with the callback to the auth endpoint. Any fix so far? @jaredpalmer
How to set the github callback URL?
https://example.com/api/auth/callback/github
Is that so?
change "example.com" to your app's URL (the one assigned on vercel)
If you've ever had a place in your code where you made api call to https://localhost:300... (that has to do with github login or any other provider) just change it to https://yourapp'sdeploymentURL... or use nullish coalescing to make calls to both local or deployment URL
Has someone managed to find a solution for the problem yet?
Hi folks, NextAuth.js maintainer here.
The callback URL for github should be:
http://localhost:3000/api/auth/callback/github
https://example.com/api/auth/callback/github
Docs: https://authjs.dev/reference/core/providers_github#callback-url
(Note, ai-chatbot uses the next-auth@experimental
version, found here, further documentation here)
If this does not work, could someone link to their project? :pray:
Instead of adding "same issue" or "how to fix" comments, consider adding a :+1: to the issue description instead
@balazsorban44 I faced the same issue. The reproduction steps are:
Repeat the steps above, but for production instead, with instances of http://localhost:3000
replaced with https://example.com
. You can find a link to my fork here.
Result: Login succeeds, but the login state on the frontend remains unchanged and requests for a login. Chat history button also does not show.
Thank you @conradkoh, I'll take a look! FYI, I just pushed some updates (#55, #56) to this repo, make sure those are incorporated.
Thanks for the explanation , I will try it today, I ask my self why it works correctly locally and on prod not works and don’t see some error on logs? Did you tested in PROD?
Em ter., 20 de jun. de 2023 às 17:41, Balázs Orbán @.***> escreveu:
Thank you @conradkoh https://github.com/conradkoh, I'll take a look! FYI, I just pushed some updates (#55 https://github.com/vercel-labs/ai-chatbot/pull/55, #56 https://github.com/vercel-labs/ai-chatbot/pull/56) to this repo, make sure those are incorporated.
— Reply to this email directly, view it on GitHub https://github.com/vercel-labs/ai-chatbot/issues/28#issuecomment-1599046715, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJIOGU4SYN46G2XSC7K2XRLXMHAD7ANCNFSM6AAAAAAZKBCXWA . You are receiving this because you commented.Message ID: @.***>
--
Mit freundlichen Grüßen
Carlos Ziegler
Mobil: 01727572563
Yes, I can reproduce this when deployed. Looking into it right now.
Same problems, I'm curious about why https://chat.vercel.ai/ works as expect ? maybe it works with vercel provider?
@wzono It doesn't work with vercel provider as well. It's weird, waiting for developers to solve this problem. I just subscribed Vercel pro plan to deploy this project but it doesn't work now :(
Looks like export const runtime = 'edge'
in app/api/auth/[...nextauth]/route.ts
was the problem. Right @jaredpalmer?
Removing it from my app fixed this issue.
@pomber removing export const runtime = 'edge' in route.ts did not solve it for me.
gotta say i'm very puzzled that the deployed site works and just forking it and filling in the env vars does not seem to work. what is wrong with my mental model? how could we be struggling so much? serverless was supposed to solve all this
Wow. Changing from
export const runtime = 'edge'
to
export const runtime = 'nodejs'
fixed it for me.
PS: I updated my code with the latest changes too https://github.com/vercel-labs/ai-chatbot/pull/74/commits/f2ae20d26b3d0f22c5aa78a67436449a6a07a590
@tomas2387 that's interesting. may I know which route you changed the runtime for?
Off the top of my head, I'm wondering if it has anything to do with the caching implemented, where perhaps the navigation is getting cached and not invalidated after the login completes.
I haven't dug too much into the details of next13 tbh, but just posting this here to seed the idea in case someone more experienced can help validate this.
The original reproduced issue is mitigated by disabling caching in the middleware. I am still not really sure how the caching can be more granularly disabled for the header, and also the root cause of the issue.
The commit that fixes this can be found here.
This was inspired by a separate issue raised here in the next-auth library.
@balazsorban44 I think you were involved in that issue thread as well, so perhaps you would have a better idea of what's going on under the hood here.
On a separate note, I'm not sure if there is a bug somewhere but it seems like using the chat functionality does not require login. Can't tell if it is a bug or intended behavior. imo it's a bug.
I released a fix, you can run pnpm up @auth/nextjs
. See the details in #76. Can someone try this and report back? (Your lockfile should reference @auth/nextjs@0.0.0-manual.179c08d4)
Tested it here: https://ai-chatbot-28-conrad.vercel.app/
Login should work fine there.
thank you @balazsorban44, updating @auth/nextjs
fixes it!
@balazsorban44 signin is working but chat is broken https://www.loom.com/share/68bb20215d3046f8bfa6fb6906f4102f
I have the same problem logging with github
pnpm up @auth/nextjs
upgradeI change export const runtime
= 'edge' to export const runtime = 'nodejs'
Can someone help me, please?
@swyxio I cannot seem to be able to look at your Loom.
@joseluistello There is a link in the error message, you can check it out for more info: https://errors.authjs.dev/#missingsecret (TLDR; create an AUTH_SECRET
environment variable)
While I was upgrading pnpm up @auth/nextjs
I encountered another error, I can no longer deploy locally.
@balazsorban44
@joseluistello your reproduction repo works for me locally, both dev and buils&start. Sounds like you might have a wrong NEXTAUTH_URL
value. See this repo for the default: https://github.com/vercel-labs/ai-chatbot/blob/5912336152af068e04ce6696253f1e2c9acc3fd6/.env.example#L9 or better yet, you can just remove this environment variable. Should not actually be necessary. (Did a cleanup of this in #80)
For anyone else having further issues, please open a new issue with an attached reproduction.
You can see a deployed (Vercel) version https://github.com/vercel-labs/ai-chatbot/issues/28#issuecomment-1602571012 with working login/logout, so I need to see your code to make sure you followed the steps https://github.com/vercel-labs/ai-chatbot/issues/28#issuecomment-1602571012 correctly.
Thanks so much for your help, Orbán, I was able to get the authentication working with github @balazsorban44 💯
Works for me too, Thanks
Edit: It works for me too (on localhost) I deployed the site to Vercel and it now shows login with Gihtub button even after logging in. Check!
Second Edit: Production works fine after removing NEXTAUTH_URL
Hi folks, NextAuth.js maintainer here.
The callback URL for github should be:
- Local:
http://localhost:3000/api/auth/callback/github
- Prod:
https://example.com/api/auth/callback/github
Docs: https://authjs.dev/reference/core/providers_github#callback-url
(Note, ai-chatbot uses the
next-auth@experimental
version, found here, further documentation here)If this does not work, could someone link to their project? 🙏
Instead of adding "same issue" or "how to fix" comments, consider adding a 👍 to the issue description instead
yes, I think this can also be explained in the README.md, which is especially useful for beginners.
@xedro98 hope you have followed the instructions on this page to create a GitHub id and secret. if your running this locally, make sure you add a home page url and Authorization callback URL to
http://localhost:3000/
could you give more details about this . met the same problem running on local.
The error I get when i run pnpm up @auth/nextjs
How do I setup the github login? I followed the intruction byt when i click login and authorize my github account, the chat UI just regreshes and still shows Login option, when I click Login again, it just refreshes the page.