Google Auth Internal Server Error
### Node Version

20.18.0

### NPM/Yarn/PNPM Version

yarn 1.22.22

### Strapi Version

5.9.0

### Operating System

Other

### Database

PostgreSQL

### Javascript or Typescript

Javascript

### Reproduction URL

_No response_

### Bug Description

When attempting to use Google provider for auth, it returns an internal server error:

![Image](https://github.com/user-attachments/assets/9e57635b-2195-4d12-8395-c10eea1aeaa0)

On the backend it is showing this error:

![Image](https://github.com/user-attachments/assets/769919a0-da8b-4fc5-8ceb-ef35c4ebf187)

This is a crucial part of my site and need some assistance finding a solution to this. I upgraded from Strapi v4 which it was working it.

Any help would be appreciated

### Steps to Reproduce

1. Create Frontend and Strapi Project
2. Add Google Provider
3. Attempt to login using Google from frontend

### Expected Behavior

It is expected to bring the user to the Google Auth screen to login

### Logs

```shell
[2025-02-07 20:17:19.547] http: GET /api/connect/google (74 ms) 302
  Error: Cannot send secure cookie over unencrypted connection
      at Cookies.set (/opt/render/project/src/node_modules/cookies/index.js:126:11)
      at ContextSession.save (/opt/render/project/src/node_modules/koa-session/lib/context.js:341:22)
      at ContextSession.commit (/opt/render/project/src/node_modules/koa-session/lib/context.js:244:16)
      at session (/opt/render/project/src/node_modules/koa-session/index.js:46:20)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async middleware (/opt/render/project/src/node_modules/@strapi/core/dist/services/metrics/middleware.js:22:5)
```

### Code Snippets

here is my middlware.js:
`module.exports = [
  {resolve: "./src/middlewares/force-https.js" }, // Force HTTPS detection
  "strapi::logger",
  "strapi::errors",

  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "default-src": ["'self'"],
          "script-src": ["'self'", "'unsafe-inline'", "'unsafe-eval'"],
          "style-src": ["'self'", "'unsafe-inline'"],
          "connect-src": ["'self'", "https:"],
          "img-src": ["'self'", "data:", "blob:", "res.cloudinary.com"],
          "media-src": ["'self'", "data:", "blob:", "res.cloudinary.com"],
          "frame-ancestors": ["'none'"],
          upgradeInsecureRequests: null,
        },
      },
    },
  },

 {
  name: "strapi::cors",
  config: {
    origin: [
      "https://groovegrade.com",
      "https://backend.groovegrade.com",
      "http://localhost:1337", 
      "http://127.0.0.1:1337",
      "https://groove-grade-backend.onrender.com"
    ],
    methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"],
    headers: ["Content-Type", "Authorization", "Origin", "Accept"],
    credentials: true,  // Enable credentials (important for authentication)
    keepHeaderOnError: true,
  },
},

  "strapi::poweredBy",
  "strapi::query",

  {
    name: "strapi::body",
    config: {
      formLimit: "100mb",
      jsonLimit: "100mb",
      textLimit: "100mb",
      formidable: {
        maxFileSize: 200 * 1024 * 1024, // 200MB
      },
    },
  },

  {
    name: "strapi::session",
    config: {
      cookie: {
        secure: true,  // Ensures cookies are only sent over HTTPS
        httpOnly: true,
        sameSite: "lax",
      },
      trustProxy: true, // Required when behind a proxy (like Render)
    },
  },
  "strapi::favicon",
  "strapi::public",

];
`

### Media

_No response_

### Additional information

Keep in mind even with middleware defaulted it won't work. 

### Confirmation Checklist

- [x] I have checked the existing [issues](https://github.com/strapi/strapi/issues) for duplicates.
- [x] I agree to follow this project's [Code of Conduct](https://github.com/strapi/strapi/blob/develop/CODE_OF_CONDUCT.md).