'nodejs jwt and mysql2 user login invalid

i can't find any errors in my code. all details are correct, but can't log in.

exports.Login = async(req, res, next) => {
    try {
        const user = await User.findOne({ where: { email: req.body.email } });

            const match = await bcrypt.compare(req.body.password, user.password);
            if(!match) return res.status(400).json({message: "The password that you've entered is incorrect."});
            const userId       = user.id;
            const username     = user.username;
            const email        = user.email;
            const accessToken  = jwt.sign({userId, username, email}, process.env.ACCESS_TOKEN_SECRET, {
                expiresIn: '20s'
            });
            const refreshToken = jwt.sign({userId, username, email}, process.env.REFRESH_TOKEN_SECRET, {
                expiresIn: '1d'
            });
            await User.update({refresh_token: refreshToken},{
                where:{
                    id: userId
                }
            });
            res.cookie('refreshToken', refreshToken, {
                httpOnly: true,
                maxAge: 24 * 60 * 60 * 1000,
                secure: true
            });
            res.json({ accessToken });
        } catch (error) {
            console.log(error)
           res.status(404).json({message: "The email address you entered isn't connected to an account."});
        }
}

my env file

ACCESS_TOKEN_SECRET = 3e9af42de397cfc9387a06972c28c23a1ac7e9a60fb6dc1f05295bc6057baf500672d4a13db5d04ea84bbc4c5679164a7723f3d49f516bb73dc3df6e3b768c8e

REFRESH_TOKEN_SECRET = 56a6d157ad7d2ee09e480960ae857e528ae546d156f47433b1afad162311c45aa520697b65d13a5c72891f6145ab1f2675886fc124027dc95f86073dd8fe1462

requst.rest err

HTTP/1.1 404 Not Found X-Powered-By: Express Access-Control-Allow-Origin: http://localhost:3000 Vary: Origin Content-Type: application/json; charset=utf-8 Content-Length: 74 ETag: W/"4a-2crpnZht5BVZxrkBrWRIKGZLTq8" Date: Fri, 22 Apr 2022 09:10:01 GMT Connection: close

{ "message": "The email address you entered isn't connected to an account." }

and console.log err (Error: secretOrPrivateKey must have a value)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source