google-cloud-dotnet: Dialogflow Client Library: FormatException: "Name does not match template: incorrect number of segments"
We are encountering a problem with the “Google.Cloud.Dialogflow.V2.ContextName.Parse” method. The full stacktrace can be found at the end of this issue. It seems like the method is completely fine with contexts such as: projects/{project-id}/agent/sessions/{sessionId}/contexts/{context-name} but fails at contexts in the following format: projects/{project-id}/agent/environments/{environment-id}/users/{user-id}/sessions/{sessionId}/contexts/{context-name}
We currently can not reproduce when a request session is in the former or in the latter format. Both behaviors are currently observed with two different google users testing an action-on-google with dialogflow which is currently in Alpha phase.
Environment details
- OS: Windows 10
- .NET version: Net Standard (2.0.3)
- Package name and version: Google.Cloud.Dialogflow.V2 (1.0.0-beta02)
Steps to reproduce
- Build an action-on-google with dialogflow and put it into alpha
- Try get a specific context by name such as in the folling code:
webhookRequest.QueryResult.OutputContexts.SingleOrDefault(context => context.ContextName.ContextId == "some-context-i-need-to-read")
- If your session contains the /environment path it will fire the exception of the title.
Stacktrace:
System.FormatException:
at Google.Api.Gax.PathTemplate.ParseName (Google.Api.Gax, Version=2.5.0.0, Culture=neutral, PublicKeyToken=3ec5ea7f18953e47)
at Google.Cloud.Dialogflow.V2.ContextName.Parse (Google.Cloud.Dialogflow.V2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=185c282632e132a0)
at Google.Cloud.Dialogflow.V2.Context.get_ContextName (Google.Cloud.Dialogflow.V2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=185c282632e132a0)
...
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 23
Great - glad you’ve got something for now. I’ve created #4665 to handle this “new and slightly different but with the same cause” breakage. I suggest you subscribe to that issue, and I’ll close it when I publish 3.0.0-beta01.
Thanks. On the move right now, but will look when I’m back at a laptop