On my NextJS project I’ve configured the better-auth passkey
plugin. Locally, through my browser (Firefox/Chrome) I can add a passkey, but not in production on Vercel. I’m using a simple button in NextJS to trigger adding a passkey:
const { data, error } = await authClient.passkey.addPasskey();
Which locally, prompts my browser (Firefox or Chrome) to a add a passkey:
However, in production on Vercel, I see the GET request to the endpoint in my browser:
https://api.mysite.com/v1/auth/passkey/generate-register-options 200 OK
And the response looks ok (I think?):
{
"challenge": "4ShVg5WW5XJRuw_2RLFzfcDuzOjt_vix5ZwXUR761qQ",
"rp": {
"name": "My App",
"id": "api.mysite.com"
},
"user": {
"id": "aWt4OWt0aHMzbXlreXZpMXc5Z3FrdHp4eGpxZW92cTA",
"name": "colin@mysite.com",
"displayName": ""
},
"pubKeyCredParams": [
{
"alg": -8,
"type": "public-key"
},
{
"alg": -7,
"type": "public-key"
},
{
"alg": -257,
"type": "public-key"
}
],
"timeout": 60000,
"attestation": "none",
"excludeCredentials": [],
"authenticatorSelection": {
"residentKey": "preferred",
"userVerification": "preferred",
"requireResidentKey": false
},
"extensions": {
"credProps": true
},
"hints": []
}
But the browser prompt to add the passkey doesn’t trigger/appear. And there’s no subsequent /passkey/verify-registration
POST request as there is locally.
I can’t figure out what the issue could be as I’m not seeing any errors in my browser or Vercel’s logs.
I’m wondering if there’s something specific to Vercel’s platform I might be missing?
Any help on where to start debugging this would be appreciated.