Next-auth production issue for okta 404error

I am tring to use next-auth with oidc and pkce configuration here is my providers setting

Providers.Okta( {
      clientId: 'myid',
      domain: 'exapme.domain.com/oauth2/default',
      protection: 'pkce',
    } )

this is redirect url st up in my orgs octa panel

https://example.mydpmain-dev.com/api/login/callback

with local development i am able to see “login with octa” where browser url reads

(http://localhost:3000/api/auth/signin?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2F)

I have also added NEXTAUTH_URL as env and set it to exapme.domain.com
howerver in production i am getting

{ "statusCode": 404, "message": "Resource not found" }

.How can I resolve this?
with bowser url being

https://exapme-domain.com/api/auth/error