Azure / Azure/azure-functions-core-tools
Azure Functions Core Tools v4 unable deploy to Kubernetes for dotnet-isolated, "Invalid property identifier character: {. Path"
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 498
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 14
Description
I am experiencing issues with using `func kubernetes deploy` for dotnet-isolated on mac
```
func kubernetes deploy --name testdurfuncapp --image-name myregistry.com/testdurfunc
```
error is
```
Invalid property identifier character: {. Path 'functionsJson.testDurableFunc_HttpStart', line 34, position 2.
```
when taking a close look it sounds like [print-functions.sh ](https://github.com/Azure/azure-functions-core-tools/blob/v4.x/src/Azure.Functions.Cli/StaticResources/print-functions.sh#L22) does not create functions.json from functions.metadata properly and hence it breaks the subsequent [deserialization logics](https://github.com/Azure/azure-functions-core-tools/blob/v4.x/src/Azure.Functions.Cli/Helpers/DockerHelpers.cs#L69)
` sed -nzE 's/^\[(.+\n {4}"name": "([^"]+)".+)\]$/"\2": \1/p' functions.metadata`
Here is how this bash script convert the functions.metadata to functions.json:
functions.metadata
```
[
{
"name": "testDurableFunc",
"scriptFile": "func-iso-dur-test.dll",
"entryPoint": "func_iso_dur_test.testDurableFunc.RunOrchestrator",
"language": "dotnet-isolated",
"properties": {
"IsCodeless": false
},
"bindings": [
{
"name": "context",
"direction": "In",
"type": "orchestrationTrigger",
"properties": {}
}
]
},
{
"name": "SayHello",
"scriptFile": "func-iso-dur-test.dll",
"entryPoint": "func_iso_dur_test.testDurableFunc.SayHello",
"language": "dotnet-isolated",
"properties": {
"IsCodeless": false
},
"bindings": [
{
"name": "name",
"direction": "In",
"type": "activityTrigger",
"dataType": "String",
"properties": {}
}
]
},
{
"name": "testDurableFunc_HttpStart",
"scriptFile": "func-iso-dur-test.dll",
"entryPoint": "func_iso_dur_test.testDurableFunc.HttpStart",
"language": "dotnet-isolated",
"properties": {
"IsCodeless": false
},
"bindings": [
{
"name": "req",
"direction": "In",
"type": "httpTrigger",
"authLevel": "Anonymous",
"methods": [
"get",
"post"
],
"properties": {}
},
{
"name": "client",
"direction": "In",
"type": "durableClient",
"properties": {}
},
{
"name": "$return",
"type": "http",
"direction": "Out"
}
]
}
]
```
result of print-functions.sh, note `"functionsJson": {"testDurableFunc_HttpStart":`
```
{
"hostJson":
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
},
"enableLiveMetricsFilters": true
}
}
},
"functionsJson": {
"testDurableFunc_HttpStart":
{
"name": "testDurableFunc",
"scriptFile": "func-iso-dur-test.dll",
"entryPoint": "func_iso_dur_test.testDurableFunc.RunOrchestrator",
"language": "dotnet-isolated",
"properties": {
"IsCodeless": false
},
"bindings": [
{
"name": "context",
"direction": "In",
"type": "orchestrationTrigger",
"properties": {}
}
]
},
{
"name": "SayHello",
"scriptFile": "func-iso-dur-test.dll",
"entryPoint": "func_iso_dur_test.testDurableFunc.SayHello",
"language": "dotnet-isolated",
"properties": {
"IsCodeless": false
},
"bindings": [
{
"name": "name",
"direction": "In",
"type": "activityTrigger",
"dataType": "String",
"properties": {}
}
]
},
{
"name": "testDurableFunc_HttpStart",
"scriptFile": "func-iso-dur-test.dll",
"entryPoint": "func_iso_dur_test.testDurableFunc.HttpStart",
"language": "dotnet-isolated",
"properties": {
"IsCodeless": false
},
"bindings": [
{
"name": "req",
"direction": "In",
"type": "httpTrigger",
"authLevel": "Anonymous",
"methods": [
"get",
"post"
],
"properties": {}
},
{
"name": "client",
"direction": "In",
"type": "durableClient",
"properties": {}
},
{
"name": "$return",
"type": "http",
"direction": "Out"
}
]
}
}
}
```
### how to reproduce the issue
```
func init --docker # choose c#-isolated
func new --template "DurableFunctionsOrchestration"
func kubernetes deploy --name testdurfuncapp --image-name myregistry.com/testdurfunc
```
Noticed the code change was introduced to address this other issue https://github.com/Azure/azure-functions-core-tools/issues/2825
Any body else is running to this issue? any thoughts on this?
Contributor guide
Research direction
Start with src/Azure.Functions.Cli/StaticResources/print-functions.sh and src/Azure.Functions.Cli/Helpers/DockerHelpers.cs around line 69. Reproduce the listed func init, new, and kubernetes deploy commands, inspect the generated functions.json, and verify that it is valid JSON and deployment succeeds for the dotnet-isolated Durable Functions sample.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, csharp, docker, kubernetes
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100