Skip to content

Commit

Permalink
Fix FAIL_ON_EMPTY_BEANS error (#58)
Browse files Browse the repository at this point in the history
* Use id when name is null. App Sync requires name field.

Just use the  function config, not the fully qualified global id.

* Prevent failure on empty beans for json parsing

* Set default timeout
  • Loading branch information
djfarrelly authored Jul 25, 2024
1 parent bb6c084 commit ba17263
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions inngest/src/main/kotlin/com/inngest/Comm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.inngest
import com.beust.klaxon.Json
import com.beust.klaxon.Klaxon
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.inngest.signingkey.getAuthorizationHeader
import java.io.IOException

Expand Down Expand Up @@ -111,6 +112,7 @@ class CommHandler(

private fun parseRequestBody(requestBody: Any?): String {
val mapper = ObjectMapper()
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
return mapper.writeValueAsString(requestBody)
}

Expand Down
3 changes: 2 additions & 1 deletion inngest/src/main/kotlin/com/inngest/Function.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ internal class InternalFunctionConfig
@JvmOverloads
constructor(
val id: String,
@Json(serializeNull = false)
val name: String?,
val triggers: MutableList<InngestFunctionTrigger>,
val triggers: MutableList<InngestFunctionTrigger> = mutableListOf(),
@Json(serializeNull = false)
val concurrency: MutableList<Concurrency>? = null,
@Json(serializeNull = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class InngestFunctionConfigBuilder {
val config =
InternalFunctionConfig(
globalId,
name,
name ?: id,
triggers,
concurrency,
batchEvents,
Expand Down
2 changes: 1 addition & 1 deletion inngest/src/main/kotlin/com/inngest/Step.kt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Step(
appId: String,
fnId: String,
data: Any?,
timeout: String?,
timeout: String? = null,
): T = invoke(id, appId, fnId, data, timeout, T::class.java)

fun <T> invoke(
Expand Down

0 comments on commit ba17263

Please sign in to comment.