nikhildhoka
nikhildhoka3w ago

Sign in flow not working on deployment on AWS Amplify

I am using the Clerk, Convex template and the sign in flow on the frontend works on my local deployment. However, it does not work on the deployment that we have on AWS Amplify. Is there a configuration that we are missing causing this issue? Here is a screenshot of the env variables configured within Amplify
No description
14 Replies
nikhildhoka
nikhildhokaOP3w ago
On the deployment in Amplify the user is rerouted back to the page with the sign in button, however, this time nothing happens even when they click sign in. So I am guessing that nothing the user's credentials are coming to the frontend but for some reason its not being processed right
Matt Luo
Matt Luo3w ago
Is this deployment for a production or non-production branch? I don't know how it works in Vite, but the Next.js env var has a public modifier in the name: NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
sshader
sshader3w ago
https://docs.convex.dev/auth/debug might be helpful to narrow down the problem
Debugging Authentication | Convex Developer Hub
You have followed one of our authentication guides but something is not working.
nikhildhoka
nikhildhokaOP3w ago
according the Clerk/Convex template, it directed to use: VITE_CLERK_PUBLISHABLE_KEY whats weird is that the frontend, and auth works on local but on the AWS Amplify deployment
Matt Luo
Matt Luo3w ago
What is your amplify deployment URL?
Matt Luo
Matt Luo3w ago
I just went through the Google Sign in and saw this:
No description
Matt Luo
Matt Luo3w ago
This might be an issue between Clerk dev mode and Google dev mode You also seemed to add some username field. Not sure what this is for
nikhildhoka
nikhildhokaOP3w ago
what is confusing is that this works locally, so not sure why it wont work on AWS Amplify with the same env variables I just tried google sign in, I dont see this Upon verifying the traffic between clerk and the frontend on amplify, I can see that clerk is sucessfully sending back the jwt token to the frontend, however the frontend logic is not able to retrieve this properly. But again, as I said earlier this is weird as this works locally
nikhildhoka
nikhildhokaOP3w ago
No description
nikhildhoka
nikhildhokaOP2w ago
Do I have to change the value of this to the value set in my amplify deployment as well for VITE_CLERK_PUBLISHABLE_KEY? https://github.com/SWE-Group6/phase2/blob/main/src/ErrorBoundary.tsx#L29 This means that clerk is doing its join in giving the JWT token however the Authenticated component from convex/react is missing configuration? @Matt Luo any ideas on what could be the issue?
Matt Luo
Matt Luo2w ago
Not off the top of my head. I think you need to go through each step in the auth/debug webpage the sshader referenced
ballingt
ballingt2w ago
@nikhildhoka when I try this I see
Failed to authenticate: "No auth provider found matching the given token", check your server auth config
Failed to authenticate: "No auth provider found matching the given token", check your server auth config
What does your convex/auth.config.ts look like? If you're using two different CLerk configs for dev and prod then you'll want to list both of them in convex/auth.config.ts https://jwt.io/ says my token is
{
"aud": "convex",
"azp": "https://main.dlriba99c1q5m.amplifyapp.com",
"email": "me@ballingt.com",
"email_verified": true,
"exp": 1733822520,
"family_name": "Ballinger",
"given_name": "Tom",
"iat": 1733786520,
"iss": "https://flowing-pangolin-4.clerk.accounts.dev",
"jti": "04<REDACTED>d2",
"name": "Tom Ballinger",
"nbf": 1733786515,
"phone_number": null,
"phone_number_verified": false,
"picture": "https://img.clerk.com/ey<REDACTED>fQ",
"sub": "user_2q<REDACTED>BN",
"updated_at": 1733785205,
"username": "thomasballinger"
}
{
"aud": "convex",
"azp": "https://main.dlriba99c1q5m.amplifyapp.com",
"email": "me@ballingt.com",
"email_verified": true,
"exp": 1733822520,
"family_name": "Ballinger",
"given_name": "Tom",
"iat": 1733786520,
"iss": "https://flowing-pangolin-4.clerk.accounts.dev",
"jti": "04<REDACTED>d2",
"name": "Tom Ballinger",
"nbf": 1733786515,
"phone_number": null,
"phone_number_verified": false,
"picture": "https://img.clerk.com/ey<REDACTED>fQ",
"sub": "user_2q<REDACTED>BN",
"updated_at": 1733785205,
"username": "thomasballinger"
}
so applicationID should be "convex" and domain should be https://flowing-pangolin-4.clerk.accounts.dev
nikhildhoka
nikhildhokaOP2w ago
export default {
providers: [
{
// Configure CLERK_JWT_ISSUER_DOMAIN on the Convex Dashboard
// See https://docs.convex.dev/auth/clerk#configuring-dev-and-prod-instances
domain: process.env.CLERK_JWT_ISSUER_DOMAIN,
applicationID: "convex",
},
],
};
export default {
providers: [
{
// Configure CLERK_JWT_ISSUER_DOMAIN on the Convex Dashboard
// See https://docs.convex.dev/auth/clerk#configuring-dev-and-prod-instances
domain: process.env.CLERK_JWT_ISSUER_DOMAIN,
applicationID: "convex",
},
],
};
I noticed that my CLERK_JWT_ISSUER_DOMAIN was configured incorrectly in the prod instance in convex and hence it was not working issue is fixed now authentication works thank you so much for the help!

Did you find this page helpful?