Firebase keys not working on CF pages

When using pages to deploy my next.js project, it says that the firebase keys are invalid.
I have made it log them when building (for debug ofc), and they are correct.
They are stored in process.env, and the domain has been added to firebase’s allowed domains.
Can anyone help?