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

Mock API - Unable to GET /v2/number_orders/ #3

Open
adam-skalicky opened this issue Sep 19, 2021 · 0 comments
Open

Mock API - Unable to GET /v2/number_orders/ #3

adam-skalicky opened this issue Sep 19, 2021 · 0 comments

Comments

@adam-skalicky
Copy link

adam-skalicky commented Sep 19, 2021

Hello,

I recently restarted my mock API instance, I believe this fetched the latest openAPI spec and is now causing an error when fetching /v2/number_orders/ API. No valid response is being returned. I believe the openAPI spec was changed and for some reason the Mock API is crashing.

I am now observing the following error message in my mock logs:

Request: GET /v2/number_orders/12ade33a-21c0-473b-b055-b3c836e1c292
Headers: map[Accept-Encoding:[gzip] Authorization:[Bearer KEY017978F9A64EFA73D20780D598099A3E_T7deCn5bkHKJWA2a2V4SQN] Cdn-Loop:[cloudflare] Cf-Connecting-Ip:[207.6.71.18] Cf-Ipcountry:[CA] Cf-Ray:[690ea4534863137e-YVR] Cf-Visitor:[{"scheme":"https"}] Connection:[close] X-Forwarded-For:[207.6.71.18] X-Forwarded-Proto:[https]]
Query: map[]
Body: {}
Request data: map[]
2021/09/19 00:19:20 http: panic serving 10.0.9.2:34610: Responding to GET /v2/number_orders/12ade33a-21c0-473b-b055-b3c836e1c292:
Generated synthetic fixture: {
"example": {
"id": "12ade33a-21c0-473b-b055-b3c836e1c292",
"connection_id": "346789098765567",
"customer_reference": "MY REF 001",
"status": "success",
"messaging_profile_id": "abc85f64-5717-4562-b3fc-2c9600",
"phone_numbers": [
{
"id": "dc8e4d67-33a0-4cbb-af74-7b58f05bd494",
"country_code": "US",
"phone_number_type": "toll_free",
"status": "success",
"requirements_status": null,
"regulatory_requirements": [],
"requirements_met": true,
"phone_number": "+19705555098",
"record_type": "number_order_phone_number"
}
],
"billing_group_id": "abc85f64-5717-4562-b3fc-2c9600",
"requirements_met": true,
"phone_numbers_count": 1,
"record_type": "number_order",
"created_at": "2018-01-01T00:00:00.000000Z",
"updated_at": "2018-01-01T00:00:00.000000Z"
},
"properties": {
"billing_group_id": {
"example": "abc85f64-5717-4562-b3fc-2c9600",
"type": "string"
},
"connection_id": {
"example": "346789098765567",
"type": "string"
},
"created_at": {
"format": "datetime",
"example": "2018-01-01T00:00:00.000000Z",
"type": "string",
"readOnly": true
},
"customer_reference": {
"example": "MY REF 001",
"type": "string"
},
"id": {
"format": "uuid",
"example": "12ade33a-21c0-473b-b055-b3c836e1c292",
"type": "string",
"readOnly": true
},
"messaging_profile_id": {
"example": "abc85f64-5717-4562-b3fc-2c9600",
"type": "string"
},
"phone_numbers": {
"items": {
"$ref": "#/components/schemas/PhoneNumber"
},
"type": "array",
"readOnly": true
},
"phone_numbers_count": {
"example": 1,
"type": "integer",
"readOnly": true
},
"record_type": {
"example": "number_order",
"type": "string",
"readOnly": true
},
"requirements_met": {
"example": true,
"type": "boolean",
"readOnly": true
},
"status": {
"enum": [
"pending",
"success",
"failure"
],
"type": "string",
"readOnly": true
},
"updated_at": {
"format": "datetime",
"example": "2018-01-01T00:00:00.000000Z",
"type": "string",
"readOnly": true
}
}
}
Schema is an object:
{
"example": {
"id": "12ade33a-21c0-473b-b055-b3c836e1c292",
"connection_id": "346789098765567",
"customer_reference": "MY REF 001",
"status": "success",
"messaging_profile_id": "abc85f64-5717-4562-b3fc-2c9600",
"phone_numbers": [
{
"id": "dc8e4d67-33a0-4cbb-af74-7b58f05bd494",
"country_code": "US",
"phone_number_type": "toll_free",
"status": "success",
"requirements_status": null,
"regulatory_requirements": [],
"requirements_met": true,
"phone_number": "+19705555098",
"record_type": "number_order_phone_number"
}
],
"billing_group_id": "abc85f64-5717-4562-b3fc-2c9600",
"requirements_met": true,
"phone_numbers_count": 1,
"record_type": "number_order",
"created_at": "2018-01-01T00:00:00.000000Z",
"updated_at": "2018-01-01T00:00:00.000000Z"
},
"properties": {
"billing_group_id": {
"example": "abc85f64-5717-4562-b3fc-2c9600",
"type": "string"
},
"connection_id": {
"example": "346789098765567",
"type": "string"
},
"created_at": {
"format": "datetime",
"example": "2018-01-01T00:00:00.000000Z",
"type": "string",
"readOnly": true
},
"customer_reference": {
"example": "MY REF 001",
"type": "string"
},
"id": {
"format": "uuid",
"example": "12ade33a-21c0-473b-b055-b3c836e1c292",
"type": "string",
"readOnly": true
},
"messaging_profile_id": {
"example": "abc85f64-5717-4562-b3fc-2c9600",
"type": "string"
},
"phone_numbers": {
"items": {
"$ref": "#/components/schemas/PhoneNumber"
},
"type": "array",
"readOnly": true
},
"phone_numbers_count": {
"example": 1,
"type": "integer",
"readOnly": true
},
"record_type": {
"example": "number_order",
"type": "string",
"readOnly": true
},
"requirements_met": {
"example": true,
"type": "boolean",
"readOnly": true
},
"status": {
"enum": [
"pending",
"success",
"failure"
],
"type": "string",
"readOnly": true
},
"updated_at": {
"format": "datetime",
"example": "2018-01-01T00:00:00.000000Z",
"type": "string",
"readOnly": true
}
}
}

But example is (type: json.RawMessage):
{
"id": "12ade33a-21c0-473b-b055-b3c836e1c292",
"connection_id": "346789098765567",
"customer_reference": "MY REF 001",
"status": "success",
"messaging_profile_id": "abc85f64-5717-4562-b3fc-2c9600",
"phone_numbers": [
{
"id": "dc8e4d67-33a0-4cbb-af74-7b58f05bd494",
"country_code": "US",
"phone_number_type": "toll_free",
"status": "success",
"requirements_status": null,
"regulatory_requirements": [],
"requirements_met": true,
"phone_number": "+19705555098",
"record_type": "number_order_phone_number"
}
],
"billing_group_id": "abc85f64-5717-4562-b3fc-2c9600",
"requirements_met": true,
"phone_numbers_count": 1,
"record_type": "number_order",
"created_at": "2018-01-01T00:00:00.000000Z",
"updated_at": "2018-01-01T00:00:00.000000Z"
}
goroutine 334 [running]:
net/http.(*conn).serve.func1(0xc000e73400)
/opt/go-1.15/go/src/net/http/server.go:1801 +0x147
panic(0x7a2280, 0xc0006a7440)
/opt/go-1.15/go/src/runtime/panic.go:975 +0x3e9
main.(*DataGenerator).generateInternal(0xc0005bf908, 0xc0005bf6d0, 0x0, 0x2, 0x2, 0xc000195e00)
/home/marcelo/repos/telnyx-mock/generator.go:399 +0x1cc5
main.(*DataGenerator).Generate(0xc0005bf908, 0xc000666a80, 0x0, 0xc0005bfac8, 0x0, 0x0, 0x1, 0x9)
/home/marcelo/repos/telnyx-mock/generator.go:107 +0x254
main.(*StubServer).HandleRequest(0xc0002f92e0, 0x8a2440, 0xc0001f5b20, 0xc000bffd00)
/home/marcelo/repos/telnyx-mock/server.go:322 +0x137a
net/http.HandlerFunc.ServeHTTP(0xc00033bd70, 0x8a2440, 0xc0001f5b20, 0xc000bffd00)
/opt/go-1.15/go/src/net/http/server.go:2042 +0x44
net/http.(*ServeMux).ServeHTTP(0xacdb00, 0x8a2440, 0xc0001f5b20, 0xc000bffd00)
/opt/go-1.15/go/src/net/http/server.go:2417 +0x1ad
net/http.serverHandler.ServeHTTP(0xc0005242a0, 0x8a2440, 0xc0001f5b20, 0xc000bffd00)
/opt/go-1.15/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc000e73400, 0x8a30c0, 0xc00098ad80)
/opt/go-1.15/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
/opt/go-1.15/go/src/net/http/server.go:2969 +0x36c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant