0

I'm getting a 502 Bad Gateway error when attempting to perform any kind of GET request on my Google App Engine application. I'm running Laravel 8 with PHP 7.4 on a standard environment. My application runs perfectly fine on a local Homestead VM.

Checking Stackdriver, I don't see anything that stands out. I just see the following:

2022-04-02 15:30:32.265 EDT
2022/04/02 19:30:32 [error] 23#23: *20 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 169.254.1.1, server: , request: "GET /api/log/heytherespider HTTP/1.1", upstream: "fastcgi://unix:/tmp/google-config/php-fpm.sock:", host: "myapp.appspot.com"
Default
2022-04-02 15:30:32.334 EDT
[02-Apr-2022 19:30:32] WARNING: [pool app] child 30 exited on signal 11 (SIGSEGV) after 572.012049 seconds from start
Default
2022-04-02 15:30:32.567 EDT
GET
502
690 B
471 ms
Chrome 99.0.4844.84
/favicon.ico
Error
2022-04-02 15:30:33.036 EDT
Uncaught signal: 11, pid=31, tid=31, fault_addr=68218886545400.
Default
2022-04-02 15:30:33.038 EDT
2022/04/02 19:30:33 [error] 23#23: *22 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 169.254.1.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/tmp/google-config/php-fpm.sock:", host: "myapp.appspot.com", referrer: "https://myapp.appspot.com/api/log/heytherespider"
Default
2022-04-02 15:30:33.038 EDT
[02-Apr-2022 19:30:33] WARNING: [pool app] child 31 exited on signal 11 (SIGSEGV) after 572.003719 seconds from start

Here is the format of my app.yaml file (I basically just copied my env file over to the area under "env_variables":

runtime: php74

env_variables:
    GOOGLE_STORAGE_BUCKET: mywebapp-app-content
    CLOUDSQL_CONNECTION_NAME: mywebapp1:us-east4:mywebapp-1
    CLOUDSQL_USER: username
    CLOUDSQL_PASSWORD: abc123
    CLOUDSQL_DATABASE_NAME: mywebapp

    APP_ENV: production
    APP_DEBUG: false
    APP_KEY: abc123

    DB_HOST: "www.xxx.yyy.zzz"
    DB_DATABASE: mywebapp
    DB_USERNAME: username
    DB_PASSWORD: abc123
    DB_USERNAME_PATH: ""
    DB_PASSWORD_PATH: ""

    CACHE_DRIVER: file
    SESSION_DRIVER: file
    QUEUE_CONNECTION: sync

    MAIL_MAILER: smtp
    MAIL_HOST: mailtrap.io
    MAIL_PORT: 2525
    MAIL_USERNAME: null
    MAIL_PASSWORD: null

    BRAINTREE_ENVIRONMENT: sandbox
    BRAINTREE_MERCHANT_ID: 12345
    BRAINTREE_PUBLIC_KEY: 12345
    BRAINTREE_PRIVATE_KEY: 12345

    FACEBOOK_APP_ID: 12345
    FACEBOOK_APP_SECRET: 12345

    SPOTIFY_CLIENT_ID: 12345
    SPOTIFY_CLIENT_SECRET: 12345

    LASTFM_API_KEY: 12345

    TEST_SERVER_HTTPS: ""
    TEST_SERVER_PORT: 0
    TEST_SERVER_HTTP_HOST: "staging.mywebapp.com"

    APP_CHAT_PHASE_DURATION: 1

    PATH_LARAVEL: ""
    PATH_WSDL: "wsdl/"

    AUTHY_API_KEY: abc123

    USER_PHOTOS_PATH: "path1/"
    TICKET_PHOTOS_PATH: "path2/"
    USER_CACHED_FACEBOOK_PATH: "path3"

    GOOGLE_MAPS_GEOCODING_API_KEY: abc123
    GOOGLE_MAPS_TIMEZONE_API_KEY: abc123
    GOOGLE_CLOUD_VISION_API_KEY: abc123
    GOOGLE_CLOUD_NATURAL_LANGUAGE_API_KEY: abc123

    SCHEDULE_CACHE_RUN: false

    DEBUG_PW: "abc123"

    FACEBOOK_ENABLE_LIKES: true

    GOOGLE_CLOUD_PROJECT_ID: mywebapp1
    GOOGLE_CLOUD_PROJECT: mywebapp1
    GOOGLE_APPLICATION_CREDENTIALS: keys/mywebapp-backend-cloud-storage-admin-key.json
    GOOGLE_CLOUD_STORAGE_BUCKET: mywebapp-app-content
    GOOGLE_CLOUD_KEY_FILE: keys/mywebapp-backend-cloud-storage-admin-key.json

    LOG_CHANNEL: stackdriver
    LOG_DEPRECATIONS_CHANNEL: null
    LOG_LEVEL: debug
wizardjoe
  • 185
  • 9
  • 1
    Most of the time the error code 502 with "BAD_GATEWAY" indicates that GAE terminated the application because it ran out of memory. Here is the [documentation link](https://cloud.google.com/endpoints/docs/openapi/troubleshoot-response-errors#error_message_bad_gateway) which explains how you would know if your application is running out of memory and 502 error codes are because of this. Also check if your app is open to requests in port 8080 and check the versions of php. Also have a look at this [thread](https://stackoverflow.com/a/60497699/15803365) by a reputed community member. – Priyashree Bhadra Apr 04 '22 at 09:10
  • It seems like the out of memory error only applies to GAE flexible environments according to the documentation. I'm using standard environment, which should be fully managed. Nevertheless, I modified the app.yaml, adding 4 gb of memory, and then did "gcloud app deploy", but it still didn't work. – wizardjoe Apr 04 '22 at 20:15
  • What is the version of php you are using? I came across these 2 bugs (https://stackoverflow.com/a/3616287/15803365), (https://stackoverflow.com/questions/36739530/php7-0-2-program-terminated-with-signal-11-segmentation-fault), while researching on your case. See if that fixes your issue. – Priyashree Bhadra Apr 05 '22 at 04:31
  • I'm using php 7.4 – wizardjoe Apr 05 '22 at 05:26
  • Are you still facing the issue? – Priyashree Bhadra Apr 19 '22 at 12:22

0 Answers0