Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List SMS fails when originator in response is invalid. #120

Open
SebastianStehle opened this issue Apr 25, 2022 · 0 comments
Open

List SMS fails when originator in response is invalid. #120

SebastianStehle opened this issue Apr 25, 2022 · 0 comments

Comments

@SebastianStehle
Copy link

SebastianStehle commented Apr 25, 2022

Hi,
I just query SMS messages:

var messageBird = Client.CreateDefault(AccessKey);

var messages = messageBird.ListMessages(string.Empty, 200);

And I got the following exception in my unit test:

[xUnit.net 00:00:17.17]     TestSuite.ApiTests.SmsTests.Should_send_sms_with_template [FAIL]
  Failed TestSuite.ApiTests.SmsTests.Should_send_sms_with_template [15 s]
  Error Message:
   MessageBird.Exceptions.ErrorException : Received response in an unexpected format!
---- Newtonsoft.Json.JsonSerializationException : Error setting value to 'Originator' on 'MessageBird.Objects.Message'.
-------- System.ArgumentException : Originator can only contain numeric or whitespace separated alphanumeric characters.
  Stack Trace:
     at MessageBird.Resources.Resource.Deserialize(String resource)
   at MessageBird.Net.RestClient.RequestWithResource[T](String method, String uri, T resource, HttpStatusCode expectedHttpStatusCode)
   at MessageBird.Net.RestClient.Retrieve[T](T resource)
   at MessageBird.Client.ListMessages(String status, Int32 limit, Int32 offset)
   at TestSuite.ApiTests.SmsTests.Should_send_sms_with_template() in /src/backend/tools/TestSuite/TestSuite.ApiTests/SmsTests.cs:line [133](https://github.com/notifo-io/notifo/runs/6162285497?check_suite_focus=true#step:10:133)
--- End of stack trace from previous location ---
----- Inner Stack Trace -----
   at Newtonsoft.Json.Serialization.ExpressionValueProvider.SetValue(Object target, Object value)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Populate(JsonReader reader, Object target)
   at Newtonsoft.Json.JsonSerializer.PopulateInternal(JsonReader reader, Object target)
   at Newtonsoft.Json.JsonConvert.PopulateObject(String value, Object target, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.PopulateObject(String value, Object target)
   at MessageBird.Resources.Resource.Deserialize(String resource)
----- Inner Stack Trace -----
   at MessageBird.Utilities.ParameterValidator.IsValidOriginator(String originator)
   at MessageBird.Objects.Message.set_Originator(String value)
   at Newtonsoft.Json.Serialization.ExpressionValueProvider.SetValue(Object target, Object value)
[xUnit.net 00:00:28.24]     TestSuite.ApiTests.SmsTests.Should_send_sms_without_template [FAIL]
  Failed TestSuite.ApiTests.SmsTests.Should_send_sms_without_template [11 s]
  Error Message:
   MessageBird.Exceptions.ErrorException : Received response in an unexpected format!
---- Newtonsoft.Json.JsonSerializationException : Error setting value to 'Originator' on 'MessageBird.Objects.Message'.
-------- System.ArgumentException : Originator can only contain numeric or whitespace separated alphanumeric characters.
  Stack Trace:
     at MessageBird.Resources.Resource.Deserialize(String resource)
   at MessageBird.Net.RestClient.RequestWithResource[T](String method, String uri, T resource, HttpStatusCode expectedHttpStatusCode)
   at MessageBird.Net.RestClient.Retrieve[T](T resource)
   at MessageBird.Client.ListMessages(String status, Int32 limit, Int32 offset)
   at TestSuite.ApiTests.SmsTests.Should_send_sms_without_template() in /src/backend/tools/TestSuite/TestSuite.ApiTests/SmsTests.cs:line 231
--- End of stack trace from previous location ---
----- Inner Stack Trace -----
   at Newtonsoft.Json.Serialization.ExpressionValueProvider.SetValue(Object target, Object value)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Populate(JsonReader reader, Object target)
   at Newtonsoft.Json.JsonSerializer.PopulateInternal(JsonReader reader, Object target)
   at Newtonsoft.Json.JsonConvert.PopulateObject(String value, Object target, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.PopulateObject(String value, Object target)
   at MessageBird.Resources.Resource.Deserialize(String resource)
----- Inner Stack Trace -----
   at MessageBird.Utilities.ParameterValidator.IsValidOriginator(String originator)
   at MessageBird.Objects.Message.set_Originator(String value)
   at Newtonsoft.Json.Serialization.ExpressionValueProvider.SetValue(Object target, Object value)

It just started recently, so I guess I have made a request before (or someone else). It is a shared account between some projects.

But if you store an invalid originator, you also have to return it.

@SebastianStehle SebastianStehle changed the title List SMS fails when original in response is invalid. List SMS fails when originator in response is invalid. Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant