question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`getAppEngineLocation` always returns 'us-central1'

See original GitHub issue

[REQUIRED] Environment info

firebase-tools: 7.1.0

Platform: macOS Mojave 10.14.5, Node v8.15.1

[REQUIRED] Test case

Deploy a cloud functions project (with scheduled functions) with an app engine location set to another region (e.g. europe-west1)

[REQUIRED] Steps to reproduce

firebase deploy --force --only functions --project some_project_id

[REQUIRED] Expected behavior

The function should return the location of the app engine found within context.firebaseConfig. e.g. App engine location set to europe-west1 should return europe-west1

[REQUIRED] Actual behavior

The function returns the default us-central1 value.

[2019-07-12T15:24:13.299Z] Error Context: {
  "body": {
    "error": {
      "code": 400,
      "message": "Location must equal europe-west1 because the App Engine app that is associated with this project is located in europe-west1",
      "status": "INVALID_ARGUMENT"
    }
  },
  "response": {
    "statusCode": 400,
    "body": {
      "error": {
        "code": 400,
        "message": "Location must equal europe-west1 because the App Engine app that is associated with this project is located in europe-west1",
        "status": "INVALID_ARGUMENT"
      }
    },
    "headers": {
      "vary": "X-Origin, Referer, Origin,Accept-Encoding",
      "content-type": "application/json; charset=UTF-8",
      "date": "Fri, 12 Jul 2019 15:24:13 GMT",
      "server": "ESF",
      "cache-control": "private",
      "x-xss-protection": "0",
      "x-frame-options": "SAMEORIGIN",
      "x-content-type-options": "nosniff",
      "alt-svc": "quic=\":443\"; ma=2592000; v=\"46,43,39\"",
      "accept-ranges": "none",
      "transfer-encoding": "chunked"
    },
    "request": {
      "uri": {
        "protocol": "https:",
        "slashes": true,
        "auth": null,
        "host": "cloudscheduler.googleapis.com",
        "port": 443,
        "hostname": "cloudscheduler.googleapis.com",
        "hash": null,
        "search": null,
        "query": null,
        "pathname": "/v1beta1/projects/some_project_id/locations/us-central1/jobs/firebase-schedule-functionName-europe-west1",
        "path": "/v1beta1/projects/some_project_id/locations/us-central1/jobs/firebase-schedule-functionName-europe-west1",
        "href": "https://cloudscheduler.googleapis.com/v1beta1/projects/some_project_id/locations/us-central1/jobs/firebase-schedule-functionName-europe-west1"
      },
      "method": "PATCH"
    }
  }
}

It seems as though the context.firebaseConfig does not have a cloudResourceLocation field (which is being used to identify the AppEngineLocation) so it is always returning undefined. Changing that field to locationId fixed this issue for me.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
atereshkovcommented, Feb 16, 2020

@joehan solution from @PatNeedham isn’t working for me, I’m using firebase 7.8.2 and I’ve set region of GCP in Firebase console.

Here’s detailed log:

Error: HTTP Error: 400, Location must equal europe-west1 because the App Engine app that is associated with this project is located in europe-west1
[2020-02-16T07:59:33.631Z] Error Context: {
  "body": {
    "error": {
      "code": 400,
      "message": "Location must equal europe-west1 because the App Engine app that is associated with this project is located in europe-west1",
      "status": "INVALID_ARGUMENT"
    }
  },
  "response": {
    "statusCode": 400,
    "body": {
      "error": {
        "code": 400,
        "message": "Location must equal europe-west1 because the App Engine app that is associated with this project is located in europe-west1",
        "status": "INVALID_ARGUMENT"
      }
    },
    "headers": {
      "vary": "X-Origin, Referer, Origin,Accept-Encoding",
      "content-type": "application/json; charset=UTF-8",
      "date": "Sun, 16 Feb 2020 07:59:33 GMT",
      "server": "ESF",
      "cache-control": "private",
      "x-xss-protection": "0",
      "x-frame-options": "SAMEORIGIN",
      "x-content-type-options": "nosniff",
      "alt-svc": "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000",
      "accept-ranges": "none",
      "transfer-encoding": "chunked"
    },
    "request": {
      "uri": {
        "protocol": "https:",
        "slashes": true,
        "auth": null,
        "host": "cloudscheduler.googleapis.com",
        "port": 443,
        "hostname": "cloudscheduler.googleapis.com",
        "hash": null,
        "search": null,
        "query": null,
        "pathname": "/v1beta1/projects/tt2helper/locations/us-central1/jobs/firebase-schedule-clansCleanCron-us-central1",
        "path": "/v1beta1/projects/tt2helper/locations/us-central1/jobs/firebase-schedule-clansCleanCron-us-central1",
        "href": "https://cloudscheduler.googleapis.com/v1beta1/projects/tt2helper/locations/us-central1/jobs/firebase-schedule-clansCleanCron-us-central1"
      },
      "method": "PATCH"
    }
  }
}

And with .region(‘europe-west1’):

Error: HTTP Error: 400, Location must equal europe-west1 because the App Engine app that is associated with this project is located in europe-west1
[2020-02-16T08:01:03.643Z] Error Context: {
  "body": {
    "error": {
      "code": 400,
      "message": "Location must equal europe-west1 because the App Engine app that is associated with this project is located in europe-west1",
      "status": "INVALID_ARGUMENT"
    }
  },
  "response": {
    "statusCode": 400,
    "body": {
      "error": {
        "code": 400,
        "message": "Location must equal europe-west1 because the App Engine app that is associated with this project is located in europe-west1",
        "status": "INVALID_ARGUMENT"
      }
    },
    "headers": {
      "vary": "X-Origin, Referer, Origin,Accept-Encoding",
      "content-type": "application/json; charset=UTF-8",
      "date": "Sun, 16 Feb 2020 08:01:03 GMT",
      "server": "ESF",
      "cache-control": "private",
      "x-xss-protection": "0",
      "x-frame-options": "SAMEORIGIN",
      "x-content-type-options": "nosniff",
      "alt-svc": "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000",
      "accept-ranges": "none",
      "transfer-encoding": "chunked"
    },
    "request": {
      "uri": {
        "protocol": "https:",
        "slashes": true,
        "auth": null,
        "host": "cloudscheduler.googleapis.com",
        "port": 443,
        "hostname": "cloudscheduler.googleapis.com",
        "hash": null,
        "search": null,
        "query": null,
        "pathname": "/v1beta1/projects/tt2helper/locations/us-central1/jobs/firebase-schedule-clansCleanCron-europe-west1",
        "path": "/v1beta1/projects/tt2helper/locations/us-central1/jobs/firebase-schedule-clansCleanCron-europe-west1",
        "href": "https://cloudscheduler.googleapis.com/v1beta1/projects/tt2helper/locations/us-central1/jobs/firebase-schedule-clansCleanCron-europe-west1"
      },
      "method": "PATCH"
    }
  }
}
3reactions
PatNeedhamcommented, Oct 5, 2019

@MaffooBristol I heard back from Firebase support after my last comment on this thread, and the response I got helped eliminate the issue:

Thanks for the logs provided. This issue could be caused by your project settings. I have checked your Firebase project, and I noticed that your project’s GCP location was empty (see screenshots). With this, could you try setting the GCP location to ‘us-east4’ and see if issue persists?

image image

On the https://console.firebase.google.com/u/0/project/PROJECT-ID/settings/general/ page - I set it to us-east4 and the Firebase functions deployments have been error-free since then thankfully!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Returns – Our Place - US
Your item must be shipped back securely to our facility. Any items that are requested to be shipped back and are not returned...
Read more >
Return an item - Google Store Help
You can return most items you bought from the Google Store within 15 calendar days after the day you receive it. Returns are...
Read more >
Returns & Refunds - Shopping Help - Apple
Find out how you can return an item, how long the refund process takes, what to do if your invoice is not with...
Read more >
Returns and Refunds - Customer Care
Use the pre-paid UPS Return Label included in your order and leave the ... but you can always return it by following the...
Read more >
HP.com returns & refunds | HP® Official Store
Download and print your prepaid shipping label. HP Returns - Step 3. Step 3. Place all items in original packaging and add your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found