You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
com.google.cloud.core.ServiceOptions.getDefaultProjectId() does not work in App Engine local environment #2209
APIs like google-cloud-pubsub require users to explicitly provide a project id.
When App Engine Maven Plugin is used to run locally using mvn appengine:run ServiceOptions.getDefaultProjectId() returns no-app-id unless <application>project-id</application> exists in appengine-web.xml
Note : returns project-id without the application entry when deployed to App Engine.
Our current approaches to retrieving project/application id fail when using gcloud sdk maven plugin and when application id is not specified in appengine-web.xml. I have filed an issue to app-maven-plugin. On a different note, based on appengine runtime contract, both GCLOUD (deprecated) and GOOGLE_CLOUD_PROJECT Env Vars should be injected to app engine runtime container. However, I'm not seeing any of these (for both local or remote servers). I'm tracking this issue with runtime team.
Our current approaches to retrieving project/application id fail when using gcloud sdk maven plugin and when application id is not specified in appengine-web.xml.
This happens regardless of the Maven plugin. For example, where and how will you get a project ID if an app doesn't use any build system? In such a case, users will run the local server directly at the command-line (which is what the Eclipse plugin does, for example.)
@chanseokoh thank you for your reply on this. The information (project/application id) is actually there (in gcloud sdk). Since this is a gcloud sdk-based plugin, I thought it would retrieive a project id when running "mvn appengine:run". I think "mvn appengine:deploy" by default does this - using the project id set by "gcloud init" as the project property. What is the design idea behind this asymmetry ?
The Maven plugin is not the only tool that is Cloud SDK-based. For example, the Eclipse plugin and the IntelliJ plugin (which share the core gcloud-related code with the Maven plugin) run gcloud app deploy (under the hood) like this:
$ gcloud app deploy .../app.yaml ... --project <project ID where you want the app to be deployed> ...
As you can see, the project ID does not come from gcloud init but from the argument explicitly given. In other words, the project ID is part of a deploy configuration, which is available (and only needed) at the time of deployment. We ask Eclipse/IntelliJ users to which projects they want their apps to be deployed through a friendly GUI. It does not make sense for users to go out of an IDE and do gcloud init every time to designate/change target projects. It's also very dangerous for IDEs to silently pick up the project set by gcloud init. That said, when running the dev server in the IDEs, a project ID simply doesn't exist.
So, even if the Maven plugin (and the Gradle plugin) populate and set a project ID configured by gcloud init, it will not solve the problem for IDE users. (Remember that this user hitting this problem is using the Eclipse plugin: #2235). You need a more fundamental solution to this problem.
Have you reached any resolution? I am very curious. If not, please update later when you come up with one. Whatever it will be, I can anticipate many problems as long as the dev server wants to know some project ID. Ideally, the dev server should just not need it.
Activity
lesv commentedon Jul 6, 2017
Ideally, when running locally on GAE std, you'll try to grab from either
GOOGLE_CLOUD_PROJECT, if defined, or (typical case), get it fromgcloud.garrettjonesgoogle commentedon Jul 17, 2017
This appears to be a problem even with clients trying to load project ID implicitly, e.g. BigQuery (user-filed issue: #2235 )
neozwu commentedon Jul 26, 2017
Our current approaches to retrieving project/application id fail when using gcloud sdk maven plugin and when application id is not specified in appengine-web.xml. I have filed an issue to app-maven-plugin. On a different note, based on appengine runtime contract, both
GCLOUD(deprecated) andGOOGLE_CLOUD_PROJECTEnv Vars should be injected to app engine runtime container. However, I'm not seeing any of these (for both local or remote servers). I'm tracking this issue with runtime team.chanseokoh commentedon Jul 26, 2017
This happens regardless of the Maven plugin. For example, where and how will you get a project ID if an app doesn't use any build system? In such a case, users will run the local server directly at the command-line (which is what the Eclipse plugin does, for example.)
I also left some comment in the maven plugin issue: GoogleCloudPlatform/app-maven-plugin#202 (comment)
neozwu commentedon Jul 27, 2017
@chanseokoh thank you for your reply on this. The information (project/application id) is actually there (in gcloud sdk). Since this is a gcloud sdk-based plugin, I thought it would retrieive a project id when running "mvn appengine:run". I think "mvn appengine:deploy" by default does this - using the project id set by "gcloud init" as the
projectproperty. What is the design idea behind this asymmetry ?chanseokoh commentedon Jul 27, 2017
The Maven plugin is not the only tool that is Cloud SDK-based. For example, the Eclipse plugin and the IntelliJ plugin (which share the core gcloud-related code with the Maven plugin) run
gcloud app deploy(under the hood) like this:$ gcloud app deploy .../app.yaml ... --project <project ID where you want the app to be deployed> ...As you can see, the project ID does not come from
gcloud initbut from the argument explicitly given. In other words, the project ID is part of a deploy configuration, which is available (and only needed) at the time of deployment. We ask Eclipse/IntelliJ users to which projects they want their apps to be deployed through a friendly GUI. It does not make sense for users to go out of an IDE and dogcloud initevery time to designate/change target projects. It's also very dangerous for IDEs to silently pick up the project set bygcloud init. That said, when running the dev server in the IDEs, a project ID simply doesn't exist.So, even if the Maven plugin (and the Gradle plugin) populate and set a project ID configured by
gcloud init, it will not solve the problem for IDE users. (Remember that this user hitting this problem is using the Eclipse plugin: #2235). You need a more fundamental solution to this problem.chanseokoh commentedon Jul 27, 2017
Also, don't forget the case where users don't use any tool (not even gcloud) but directly invoke the dev server at the command-line.
$ java ... -Dappengine.sdk.root=... -cp .../appengine-tools-api.jar com.google.appengine.tools.development.DevAppServerMain --port=8080 <some app directory>We need a solution to avoid the problem in this case too.
chanseokoh commentedon Jul 28, 2017
Have you reached any resolution? I am very curious. If not, please update later when you come up with one. Whatever it will be, I can anticipate many problems as long as the dev server wants to know some project ID. Ideally, the dev server should just not need it.
7 remaining items
sduskis commentedon Jul 1, 2019
This issue seems a bit stale. This is also not actionable in this repository. GoogleCloudPlatform/appengine-plugins#439 is open, so I'm going to close this PR.
build(deps): update dependency org.apache.maven.plugins:maven-shade-p…
build(deps): update dependency org.apache.maven.plugins:maven-shade-p…
chore(main): release 1.133.1-SNAPSHOT (#2209)
chore(main): release 1.133.1-SNAPSHOT (#2209)
chore(main): release 2.39.0 (googleapis#2209)