title: How to deploy Ktor app on Google App Engine?
body: <p>The official tutorial from <a href="https://ktor.io/servers/deploy/hosting/google-app-engine.html" rel="nofollow noreferrer">Ktor.io</a> doesn't work, I tried it.
  It's my first deploy. Thanks for help.</p>
  
  <p>My gradle file (kts):</p>
  
  <pre><code>import com.google.cloud.tools.gradle.appengine.appyaml.AppEngineAppYamlExtension
  
  buildscript {
      dependencies {
          classpath("com.google.cloud.tools:appengine-gradle-plugin:2.2.0")
      }
  }
  
  apply {
      plugin("com.google.cloud.tools.appengine")
  }
  
  plugins {
      // Support for Kotlin
      id("org.jetbrains.kotlin.jvm") version "1.3.61"
      // Support for building a CLI application
      application
      // Documentation
      id("org.jetbrains.dokka") version "0.10.1"
  
      war
  //    id("com.improve_future.harmonica") version "1.1.24"
  }
  
  application {
      mainClassName = "com.easythings.parkkometr.AppKt"
      group = "com.easythings"
      version = "0.0.1"
  }
  
  sourceSets {
      main {
          java.srcDir("app/main/src")
          resources.srcDir("app/main/resources")
      }
      test {
          java.srcDir("app/test/src/")
          resources.srcDir("app/test/resources/")
      }
  }
  
  repositories {
      jcenter()
      maven { setUrl("https://kotlin.bintray.com/ktor") }
  }
  
  dependencies {
      val ktorVersion: String by project
      val logbackVersion: String by project
      val exposedVersion: String by project
      val pgVersion: String by project
      val spekVersion: String by project
      val sendGridVersion: String by project
      val assertJVersion: String by project
  
      // Kotlin ============================================================================
      implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
      implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
  
      // Libs ============================================================================
      // Ktor - framework
      implementation("io.ktor", "ktor-server-jetty", ktorVersion)
      implementation("io.ktor", "ktor-server-core", ktorVersion)
      implementation("io.ktor", "ktor-server-host-common", ktorVersion)
      implementation("io.ktor", "ktor-auth", ktorVersion)
      implementation("io.ktor", "ktor-auth-jwt", ktorVersion)
      implementation("io.ktor", "ktor-gson", ktorVersion)
      implementation("io.ktor", "ktor-network-tls-certificates", ktorVersion)
  
      // Logback - application logger
      implementation("ch.qos.logback", "logback-classic", logbackVersion)
  
      // Exposed - orm
      implementation("org.jetbrains.exposed", "exposed-core", exposedVersion)
      implementation("org.jetbrains.exposed", "exposed-dao", exposedVersion)
      implementation("org.jetbrains.exposed", "exposed-jdbc", exposedVersion)
      implementation("org.jetbrains.exposed", "exposed-jodatime", exposedVersion)
  
      // Postgresql - database driver
      implementation("org.postgresql", "postgresql", pgVersion)
  
      // SendGrid - mailer
      implementation("com.sendgrid", "sendgrid-java", sendGridVersion)
  
      // Deploy ============================================================================
      providedCompile("com.google.appengine", "appengine", "1.9.60")
  
      // Tests ============================================================================
  }
  
  tasks {
      dokka {
          outputDirectory = "$buildDir/docs/dokka"
          outputFormat = "html"
      }
  
      test {
          useJUnitPlatform {
              includeEngines("spek2")
          }
      }
  }
  
  configure&lt;AppEngineAppYamlExtension&gt; {
      deploy {
          setAppEngineDirectory(".")
          version = "1"
          projectId = "XYZ-placeholder"
          stopPreviousVersion = true  // default - stop the current version
          promote = true              // default - &amp; make this the current version
      }
      stage {
          setAppEngineDirectory(".")
      }
  }
  </code></pre>
  
  <p>My app.yaml file:</p>
  
  <pre><code>runtime: java
  env: flex
  
  handlers:
    - url: /.*
      script: this field is required, but ignored
  </code></pre>
  
  <p>I get information that the deploy has finished successfully, but I get a 403 error when I call <code>gcloud app browse</code>.</p>
  
  <blockquote>
    <p>HTTP ERROR 403 Problem accessing /. Reason:</p>
  
  <pre><code>Forbidden
  </code></pre>
  </blockquote>
  
  <p>I think that my app doesn't start and it's the error from Jetty, but I don't know how to check/confirm and fix it.</p>
  
  <p>The task <code>appengineRun</code> doesn't exist in this version GAE.</p>