Kotless Hello World example fails deploying on AWS
stefan-zh opened this issue · 4 comments
stefan-zh commented
I am experiencing issues when trying to deploy the "Hello World" example for Kotless. I'm using the latest version of Kotless 0.1.7-beta-4
.
> Task :deploy
data.aws_iam_policy_document.kotless_static_assume: Refreshing state...
data.aws_caller_identity.current: Refreshing state...
data.aws_region.current: Refreshing state...
aws_api_gateway_rest_api.karti4ko: Refreshing state... [id=a9aty1vil1]
data.aws_s3_bucket.kotless_bucket: Refreshing state...
data.aws_iam_policy_document.kotless_static_policy: Refreshing state...
aws_api_gateway_deployment.root: Creating...
aws_iam_role.kotless_static_role: Creating...
Error: Error creating API Gateway Deployment: BadRequestException: The REST API doesn't contain any methods
on karti4ko.tf line 14, in resource "aws_api_gateway_deployment" "root":
14: resource "aws_api_gateway_deployment" "root" {
Error: Error creating IAM Role kotless-static-role: EntityAlreadyExists: Role with name kotless-static-role already exists.
status code: 409, request id: 8b6b2879-29be-4cfe-8028-f585f3ec1ece
on karti4ko.tf line 31, in resource "aws_iam_role" "kotless_static_role":
31: resource "aws_iam_role" "kotless_static_role" {
BUILD SUCCESSFUL in 47s
6 actionable tasks: 2 executed, 4 up-to-date
22:47:36: Task execution finished 'deploy'.
I have 1 file, Functions.kt
, containing the following:
package com.serverless.karti4ko
import io.kotless.dsl.lang.http.Get
@Get("/")
fun sayHello() = "Say Hello!"
My build.gradle.kts
looks like this
import io.kotless.plugin.gradle.dsl.kotless
group = "com.serverless.karti4ko"
version = "1.0-SNAPSHOT"
plugins {
kotlin("jvm") version "1.3.72" apply true
id("io.kotless") version "0.1.7-beta-4" apply true
}
repositories {
jcenter()
}
dependencies {
implementation("io.kotless", "kotless-lang", "0.1.7-beta-4")
}
kotless {
config {
bucket = "my.serverless.bucket"
terraform {
profile = "my.kotless.user"
region = "eu-west-1"
}
}
webapp {
lambda {
kotless {
packages = setOf("com.serverless.karti4ko")
}
}
}
}
Expected events
- Gradle deployment task should not be successful when the deployment is unsuccessful.
- The "Hello World" example as given on the README for Kotless should deploy successfully.
TanVD commented
Are you building on Windows? If that's the case, please check that new line feeds are LF. It is a well-known bug that should be fixed.
stefan-zh commented
Hey @TanVD I'm building on Windows. I converted all line feeds to LF, but I still got the same error above.
hamadycisse commented
I have the same issue.
How can I deploy the same Kotless app into different AWS environments (prod/dev)?
hamadycisse commented
I was able to solve the issue by using a prefix
kotless {
config {
prefix = System.getenv("DEPLOYMENT_PREFIX") ?: "dev"
}
}