title: IllegalStateException with Google App Engine Local Datastore
body: <p>So I'm trying to run a Google <code>App</code> Engine with the <code>Datastore</code> locally to test and debug. The local <code>App</code> Engine seems to work on its own, as does the <code>datastore</code> emulator. </p>
  
  <p>But as soon as I set the environment variables for the <code>datastore</code> emulator, and restart the local App Engine, it crashes with the error, </p>
  
  <pre><code>Caused by: java.lang.IllegalStateException: Must use project ID as app ID if project ID is provided. 
  </code></pre>
  
  <p>I've attached a more complete stack trace below </p>
  
  <p>From the error message, I suspected I need to change my project id to the project name instead. So I tried replacing various instances of the project id with the project name where I could and unfortunately this did not work either.</p>
  
  <p>Commands I'm running:</p>
  
  <pre><code>1. gcloud config set project PROJECT-ID
  2. export ENDPOINTS_SERVICE_NAME=name.endpoints.PROJECT-ID.cloud.goog
  3. gcloud beta emulators datastore start
  4. $(gcloud beta emulators datastore env-init)
  5. mvn appengine:run
  </code></pre>
  
  <p>I've put the stack trace on pastebin 
  <a href="https://pastebin.com/atcnYwrq" rel="nofollow noreferrer">https://pastebin.com/atcnYwrq</a></p>