Christian Schwoerer
12/18/2020, 11:57 AM{
"value1": 20,
"value2": 3.33
}
The result should look like this:
{
"result": 66.6
}
Am I doing this right?
@Post("/multiply")
fun multiply(): String {
val objectMapper = createObjectMapper()
val requestBody = KotlessContext.HTTP.request.body?.let { String(it, UTF_8) }
val request = objectMapper.readValue(requestBody, Request::class.java)
val result = request.value1 * request.value2
return objectMapper.writeValueAsString(Response(result))
}
data class Request(
val value1: BigDecimal,
val value2: BigDecimal
)
data class Response(
val result: BigDecimal
)
private fun createObjectMapper() = ObjectMapper().findAndRegisterModules().setSerializationInclusion(NON_NULL)
Is this the only way to extract the body and create a JSON response? Or ist there anything more convenient like @RequestBody
or to create the JSON response?Christian Schwoerer
01/18/2021, 7:22 PMmiguelmoreno
01/31/2021, 9:25 PMTanVD
02/01/2021, 12:29 PMMárton Tóth
02/08/2021, 6:43 PMGary
02/11/2021, 5:38 AMwebapp {
route53 = Route53("spring.short", "<http://kotless.io|kotless.io>")
}
Wondering if this is expected behaviour or am I doing something wrong? Or is the sample broken?
It works fine locally.Hunter Kelly
02/17/2021, 2:32 PMHunter Kelly
03/03/2021, 2:07 PM@Post("/createItems")
fun createItems(info: ItemInfo): HttpResponse {
ItemStorage.createItems(info)
return HttpResponse(201, MimeType.JSON, "")
}
data class ItemInfo(
val name: String,
val count: Int,
val details: String,
)
But when I make the following call, I get an error that the parameter is missing:
POST /1/createItems HTTP/1.1
Accept: application/json, */*;q=0.5
{
"info": {
"count": 10,
"details": "test1 details",
"name": "test1"
}
}
Response is:
HTTP/1.1 500 Internal Server Error
Connection: keep-alive
Content-Length: 35
Content-Type: text/plain
Date: Wed, 03 Mar 2021 13:56:42 GMT
Required argument 'info' is missing
Christian Schwoerer
03/12/2021, 10:41 AMplan
is:
Error: Invalid resource name
on <http://breakeven.tf|breakeven.tf> line 77, in resource "aws_iam_role" "0":
77: resource "aws_iam_role" "0" {
A name must start with a letter or underscore and may contain only letters,
digits, underscores, and dashes.
The corresponding part of the terraform script looks like this:
resource "aws_iam_role" "0" {
name = "0"
assume_role_policy = data.aws_iam_policy_document.0_assume.json
}
The part of the build.gradle.kts
like this:
kotless {
config {
bucket = "our-bucket-name"
terraform {
profile = "my-aws-user"
region = "eu-central-1"
}
}
webapp {
lambda {
kotless {
packages = setOf("info.novatec")
}
}
}
}
We’ve tried different Kotless versions (0.1.6, 0.1.7-beta-4, 0.1.7-beta-5).
Anyone an idea what we’re doing wrong?Abhishek Bansal
03/19/2021, 6:41 PMhello world
Ktor
app with kotless plugin and Kotlin gradle DSL but keep hitting following error at gradle sync step
> Failed to notify project evaluation listener.
> Could not initialize class io.kotless.parser.KotlessDescriptor
Here is gradle script that I have written
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import io.kotless.plugin.gradle.dsl.kotless
import io.kotless.resource.Lambda.Config.*
plugins {
kotlin("jvm") version "1.4.21"
id ("tanvd.kosogor") version "1.0.10"
id("io.kotless") version "0.1.7-beta-5" apply true
}
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
jcenter()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21")
classpath("io.kotless:gradle:0.1.7-beta-5")
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
languageVersion = "1.4"
apiVersion = "1.4"
}
}
repositories {
mavenCentral()
gradlePluginPortal()
jcenter()
}
group = "dev.abhishekbansal"
version = "1.0"
dependencies {
implementation("io.kotless", "ktor-lang", "0.1.7-beta-5")
}
Here is link to full project https://github.com/abhishekBansal/hello-world-ktor-aws-lambda
Any pointers here?Abhishek Bansal
03/21/2021, 5:22 AMKotless
child class like this class Server : Kotless() {}
?
I only want to run my application locally and without DynamoDB emulation.Abhishek Bansal
04/17/2021, 1:19 PMstaging
,production
etc? One way that I can think of right now is to do this
profile = System.getEnv("ENV_PROFILE")
and so on instead of hardcoding them. And how can I set some of the environment variables on lambda. Like for instance if I am writing a service which calls some other service but that other service URL depends on an environment variable. Is that kind of configuration supported?Abhishek Bansal
04/25/2021, 2:48 PMAlexandre Brown
05/09/2021, 4:26 AMUnable to find method ''boolean com.google.common.base.Platform.stringIsNullOrEmpty(java.lang.String)''
'boolean com.google.common.base.Platform.stringIsNullOrEmpty(java.lang.String)'
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
I deleted my gradle cache and it didn't solve the issue.
My first intuition would be to believe I am missing something in my reflection.json
but I am not sure.
I can build the project, I can deploy locally, I cannot deploy to AWS.
Versions :
• JVM : 1.4.21
• Gradle : 7.0
• JVM Target: 11
• Kotless: 0.1.7-beta-5
• DSL: ktor-lang 0.1.7-beta-5
Here is the repo : https://github.com/AlexandreBrown/KotlessSetup
Any help is appreciatedSean Abbott
06/02/2021, 2:20 PMExecution failed for task ':serverless:generate'.
> 'org.jetbrains.kotlin.analyzer.AnalysisResult org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(org.jetbrains.kotlin.com.intellij.openapi.project.Project, java.util.Collection, org.jetbrains.kotlin.resolve.BindingTrace, org.jetbrains.kotlin.config.CompilerConfiguration, kotlin.jvm.functions.Function1, kotlin.jvm.functions.Function2, org.jetbrains.kotlin.com.intellij.psi.search.GlobalSearchScope, int, java.lang.Object)'
I have no idea where to go looking for how to troubleshoot this. Any suggestions?Ajay Puli
06/22/2021, 3:18 PMExecution failed for task ':local'.
> Could not resolve all files for configuration ':runtimeClasspath'.
> Could not find io.kotless:kotless-lang-aws:0.1.7-beta-5.
Searched in the following locations:
- <https://dl.google.com/dl/android/maven2/io/kotless/kotless-lang-aws/0.1.7-beta-5/kotless-lang-aws-0.1.7-beta-5.pom>
- <https://repo.maven.apache.org/maven2/io/kotless/kotless-lang-aws/0.1.7-beta-5/kotless-lang-aws-0.1.7-beta-5.pom>
- <https://jcenter.bintray.com/io/kotless/kotless-lang-aws/0.1.7-beta-5/kotless-lang-aws-0.1.7-beta-5.pom>
- <https://maven.springframework.org/release/io/kotless/kotless-lang-aws/0.1.7-beta-5/kotless-lang-aws-0.1.7-beta-5.pom>
- <https://maven.restlet.com/io/kotless/kotless-lang-aws/0.1.7-beta-5/kotless-lang-aws-0.1.7-beta-5.pom>
- file:/Users/puliajay/Documents/kotlin_backend/Sample_Kotless/lib/kotless-lang-aws-0.1.7-beta-5.jar
- file:/Users/puliajay/Documents/kotlin_backend/Sample_Kotless/lib/kotless-lang-aws.jar
- file:/Users/puliajay/Documents/kotlin_backend/Sample_Kotless/lib1/kotless-lang-aws-0.1.7-beta-5.jar
- file:/Users/puliajay/Documents/kotlin_backend/Sample_Kotless/lib1/kotless-lang-aws.jar
- file:/Users/puliajay/Documents/kotlin_backend/Sample_Kotless/lib2/kotless-lang-aws-0.1.7-beta-5.jar
- file:/Users/puliajay/Documents/kotlin_backend/Sample_Kotless/lib2/kotless-lang-aws.jar
Required by:
project :
Please tell me how to resolve this error.v79
08/09/2021, 7:05 PMkotless
have a relationship to ktor
?v79
08/10/2021, 7:30 PMdeploy
or plan
tasks fail with the error:
Execution failed for task ':initialize'.
> Command failed: 'D:\Development\Experiments\Kotless\KotlessTestBeta\build\kotless-bin\terraform '
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':initialize'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:188)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$$Lambda$481/0x0000000000000000.accept(Unknown Source)
In my build folder there is no folder called kotless-bin\terraform
.nordiauwu
08/11/2021, 4:06 PMv79
08/19/2021, 9:32 PMget("/load-markdown/{s3key}")
- this is working fine locally, but when I try to deploy to AWS, terraform blows up with an Invalid resource name message:
Error: Invalid resource name
on <http://KotlessTestBeta.tf|KotlessTestBeta.tf> line 79, in resource "aws_api_gateway_integration" "load_markdown_{s3key}_get":
79: resource "aws_api_gateway_integration" "load_markdown_{s3key}_get" {
A name must start with a letter or underscore and may contain only letters,
digits, underscores, and dashes.
What horrible thing have I done wrong? (Kotless 0.2.0 compiled from source).Ronny Bräunlich
11/16/2021, 6:25 PMÁlvaro Blázquez Checa
12/22/2021, 4:39 PMSuser
12/29/2021, 3:45 AMmiqbaldc
01/05/2022, 11:32 AMHakon Grotte
02/09/2022, 1:38 PM-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005
on jvm target 11, and subsequently my Remove JVM debug manages to connect, loggint the following message: Connected to the target VM, address: 'localhost:5005', transport: 'socket'
.
When I attempt to run my route endpoints IntelliJ does not stop on my breakpointsPJ Walstrom
02/10/2022, 6:17 PM$ ./gradlew deploy
> Task :generate FAILED
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':generate' (type 'KotlessGenerateTask').
- In plugin 'io.kotless' type 'io.kotless.plugin.gradle.tasks.gen.KotlessGenerateTask' property 'myTargetVersion' doesn't have a configured value.
elect
04/11/2022, 3:21 PMv79
06/12/2022, 2:17 PMMichal Fudala
09/06/2022, 11:57 AMShawn Witte
11/08/2022, 8:57 AMGET
data from the backend and I'd like to update that data on deployments (so people can submit updates to a GitHub repo for ease of collaboration). Is this an ideal usecase for serverless? I had a solution in Ktor that was deploying to Heroku, but they got rid of their free tier and now that I'm poking around again, it looks like serverless might naturally align with my usecase a little better (but I'm not sure, since I have no real backend experience to use as a reference point).