Deploy On Google App Engine, not working

Hello my friends!

I’ve been looking for a solution to my problem for many hours!
I have validated many hypotheses and several readings in this forum and in other sources.

Can anyone help me? I will be very grateful.

My scenario:
Strapi Deploy on Google App Engine with database on Postgres.
I followed the steps in these two articles:
First - Deployment - Strapi Developer Docs
Second - Google App Engine Deployment - Strapi Developer Docs

My main error is:

Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.

In my log I get this error:

2022-10-06 17:31:35 default[20221006t140037]  Error: Knex: run
2022-10-06 17:31:35 default[20221006t140037]  $ npm install pg --save
2022-10-06 17:31:35 default[20221006t140037]  Cannot find module 'pg'
2022-10-06 17:31:35 default[20221006t140037]  Require stack:

I already ran the command “npm install pg --save” in the Cloud Shell of the postgres instance

But I’m still unsuccessful.

Other important information:

patch config/env/production/database.js

module.exports = ({ env }) => ({
    connection: {
      client: 'postgres',
      connection: {
        host: env('DATABASE_HOST', '***.151.***.78'),
        //host: `/cloudsql/${env('INSTANCE_CONNECTION_NAME')}`,
        port: env.int('DATABASE_PORT', 5432),
        database: env('DATABASE_NAME', 'db-strapi'),
        user: env('DATABASE_USERNAME', 'postgres'),
        password: env('DATABASE_PASSWORD', '*****'),
        schema: env('DATABASE_SCHEMA', 'public'), // Not required
        ssl: {
          rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false), // For self-signed certificates
        },
      },
      debug: false,
    },
  });
   

File .env

HOST=0.0.0.0
PORT=1337
APP_KEYS=6Tj9s6iaLexQ6kC9Nv22eA==,7hR62za+5EUyfH/i001EGw==,hPxvaBoTTjk2WAXwr1Bkqg==,mpWwOmt2OvYbbmbAbxtidw==
API_TOKEN_SALT=c6ZtL5Q0yr+hkICZIQcDVw==
ADMIN_JWT_SECRET=mS1sxzjA+EqOy5mMh6ZGgg==
JWT_SECRET=qCwHUmJLrAY0UdbJ2z+eXw==
APP_HOST=0.0.0.0
NODE_PORT=1337
INSTANCE_CONNECTION_NAME=elite-outpost-364614:southamerica-east1:strapi

app.yaml

runtime: nodejs16

instance_class: F2

env_variables:
  HOST: '0.0.0.0'
  NODE_ENV: 'production'
  DATABASE_NAME: 'strapi'
  DATABASE_USER: 'postgres'
  DATABASE_PASSWORD: '*****'
  INSTANCE_CONNECTION_NAME: 'elite-outpost-364614:southamerica-east1:strapi'

beta_settings:
  cloud_sql_instances: 'elite-outpost-364614:southamerica-east1:strapi'

Does anyone have any ideas?
thanks!

I had the similar problem and then followed these steps to resolve Strapi (Headless CMS), Google Cloud Run, and PostgreSQL | by Ganesh, Mohan | Jan, 2023 | Medium