Domain in cookie not being set properly after deploying but works in localhost

I am creating a full stack application using the MERN stack and I’m deploying it to render but when I try to send a cookie with the headers sameSite: “None”, secure: true, and domain: “.onrender.com” it does not set the cookie in the applications at all.

When I get rid of the domain header, the cookie is set but the domain is set to my backend url “backend-api.onrender.com” so my frontend “frontend.onrender.com” cannot read it. When I test it out using localhost everything works because the domain is localhost and both my frontend and backend are using that domain. Is there any way I can fix this issue?