JetBrains / azure-tools-for-intellij

Azure Toolkit for JetBrains Rider.
MIT License
45 stars 10 forks source link

Unknown JSON token error in local.settings.json file preventing running/debugging #811

Closed JensSchadron closed 2 months ago

JensSchadron commented 2 months ago

Hi,

I've recently updated again to the latest stable version of Rider (2024.1) after having used the EAPs, but started encountering an issue since yesterday that prevents me from running or debugging a .NET 8 isolated function app (unsure if it's related to it being isolated and not in-process though)

The error in question is the following one (as far as I could dig it up in the logs that is)

2024-04-11 23:33:28,199 [1037425]   INFO - #com.microsoft.azure.toolkit.intellij.legacy.function.coreTools.FunctionCoreToolsInfoProvider - Could not determine Azure Core Tools path from configuration
2024-04-11 23:33:28,229 [1037455]   WARN - #com.microsoft.azure.toolkit.intellij.legacy.function.runner.localRun.HostJsonPatcher - Could not find host.json file to patch.
2024-04-11 23:33:28,241 [1037467]   INFO - #c.i.e.r.ExecutionUtil - Error running 'Project.Functions':<br>Unexpected JSON token at offset 155: Encountered an unknown key 'CosmosDb' at path: $.Values
Use 'ignoreUnknownKeys = true' in 'Json {}' builder to ignore unknown keys.
JSON input: .....E": "dotnet-isolated"
  },
  "CosmosDb": {
    "AccountEndpo.....
kotlinx.serialization.json.internal.JsonDecodingException: Unexpected JSON token at offset 155: Encountered an unknown key 'CosmosDb' at path: $.Values
Use 'ignoreUnknownKeys = true' in 'Json {}' builder to ignore unknown keys.
JSON input: .....E": "dotnet-isolated"
  },
  "CosmosDb": {
    "AccountEndpo.....
    at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:24)
    at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:32)
    at kotlinx.serialization.json.internal.AbstractJsonLexer.fail(AbstractJsonLexer.kt:598)
    at kotlinx.serialization.json.internal.AbstractJsonLexer.failOnUnknownKey(AbstractJsonLexer.kt:593)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.handleUnknown(StreamingJsonDecoder.kt:254)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeObjectIndex(StreamingJsonDecoder.kt:240)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeElementIndex(StreamingJsonDecoder.kt:175)
    at com.microsoft.azure.toolkit.intellij.legacy.function.runner.localRun.localsettings.FunctionLocalSettings$$serializer.deserialize(FunctionLocalSettings.kt:10)
    at com.microsoft.azure.toolkit.intellij.legacy.function.runner.localRun.localsettings.FunctionLocalSettings$$serializer.deserialize(FunctionLocalSettings.kt:10)
    at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
    at kotlinx.serialization.json.Json.decodeFromString(Json.kt:107)
    at com.microsoft.azure.toolkit.intellij.legacy.function.runner.localRun.localsettings.FunctionLocalSettingsUtil.readFunctionLocalSettings(FunctionLocalSettingsUtil.kt:47)
    at com.microsoft.azure.toolkit.intellij.legacy.function.runner.localRun.FunctionRunExecutorFactory$create$functionLocalSettings$1.invokeSuspend(FunctionRunExecutorFactory.kt:56)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

The affected local.settings.json file looks something along the lines of:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
  },
  "CosmosDb": {
    "AccountEndpoint": "omitted",
    "DatabaseId": "omitted"
  }
}

I was able to verify that rolling back to Rider 2023.3.4 with preview 2 of the plugin fixes the issue for the time being. If there's anything else that I need to check, please let me know.

And for completeness sake, most information of both installations.

Azure Functions Core Tools
Core Tools Version:       4.0.5611 Commit hash: N/A +591b8aec842e333a87ea9e23ba390bb5effe0655 (64-bit)
Function Runtime Version: 4.31.1.22191

System information of working installation (Rider 2023.3.4)

JetBrains Rider 2023.3.4
Build #RD-233.14475.66, built on March 6, 2024
Licensed to Jens Schadron
Subscription is active until July 27, 2024.
Runtime version: 17.0.10+1-b1087.17 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.4.1
.NET Core v7.0.10 ARM64 (Server GC)
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 10
Metal Rendering is ON
Registry:
  editor.config.csharp.support=true
  ide.experimental.ui=true
Non-Bundled Plugins:
  carbon-now-sh (1.3.0)
  com.intellij.resharper.HeapAllocationsViewer (2023.3.0)
  fluentassertions-rider (2023.3.0)
  some.awesome (1.15)
  CyclomaticComplexity (2023.3.0)
  com.andrey4623.rainbowcsv (2.0.2)
  com.jetbrains.rider.android (233.14475.66)
  com.eclectide.intellij.whatthecommit (1.3)
  cognitivecomplexity-rider (2023.3.0)
  me.rafaelldi.aspire (0.2.4)
  Statistic (4.2.14)
  Key Promoter X (2024.1.0)
  com.wakatime.intellij.plugin (14.3.13)
  com.intellij.resharper.StructuredLogging (2023.3.2.321)
  com.intellij.rider.plugins.nuke (2023.3.0)
  com.intellij.grazie.pro (0.3.296)
  tanvd.grazi (233.13135.14)
  com.github.copilot (1.5.2.5385-nightly)
  com.microsoft.vso.idea (1.162.2)
  com.intellij.resharper.azure (4.0.0-preview.2)

System information of broken installation (Rider 2024.1)

JetBrains Rider 2024.1
Build #RD-241.14494.307, built on April 8, 2024
Licensed to Jens Schadron
Subscription is active until July 27, 2024.
Runtime version: 17.0.10+8-b1207.12 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.4.1
.NET Core v8.0.1 ARM64 (Server GC)
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 10
Metal Rendering is ON
Registry:
  ide.experimental.ui=true
  terminal.new.ui=true
  ide.new.project.model.index.case.sensitivity=true
Non-Bundled Plugins:
  carbon-now-sh (1.3.0)
  com.intellij.resharper.HeapAllocationsViewer (2024.1.0-eap01)
  some.awesome (1.15)
  CyclomaticComplexity (2024.1.0-eap01)
  com.jetbrains.space (241.14494.150)
  com.andrey4623.rainbowcsv (2.0.2)
  com.jetbrains.rider.android (241.14494.307)
  com.eclectide.intellij.whatthecommit (1.3)
  cognitivecomplexity-rider (2024.1.0-eap01)
  Statistic (4.2.14)
  Key Promoter X (2024.1.0)
  com.wakatime.intellij.plugin (14.3.13)
  com.intellij.resharper.StructuredLogging (2024.1.0.323-eap01)
  com.intellij.grazie.pro (0.3.296)
  com.github.copilot (1.5.2.5385-nightly)
  com.microsoft.vso.idea (1.162.2)
  com.intellij.resharper.azure (4.0.0-preview.3)
rafaelldi commented 2 months ago

@JensSchadron Thank you for the report and sorry for the inconvenience. I will soon publish a new preview release and will fix this issue.

JensSchadron commented 2 months ago

No worries, I'm fully aware that those things can happen when you're using preview versions and I'm happy to help out by reporting them. 😄