TL;DR:
make sure that the [...nextauth].ts defines the secrets correctly
Explanation
NextAuth looks up the secrets:
# in NextAuthApiHandler
(_options$secret = options.secret) !== null && _options$secret !== void 0 ? _options$secret : options.secret = (_options$jwt$secret = (_options$jwt = options.jwt) === null || _options$jwt === void 0 ? void 0 : _options$jwt.secret) !== null && _options$jwt$secret !== void 0 ? _options$jwt$secret : process.env.NEXTAUTH_SECRET;
So it's using secrets in the following order:
options.secret
options.jwt.secret
process.env.NEXTAUTH_SECRET
the options are taken from:
# [...nextauth].ts
...
jwt: {
secret: process.env.SECRET,
},
...
secret: process.env.SECRET,
...
thus, you need to make sure that the .env file (especially if there are more than one) defines the values correctly which are being used at these places - an empty value isn't sufficient - openssl rand -hex 32
would do the job.