trying to import a Postman collection and I'm getting this error in an alert dialog:
Import Failed
TypeError: null is not an object (evaluating 'postmanBodyData.length')
And then this in the console:
JS Exception Line 54. TypeError: null is not an object (evaluating 'postmanBodyData.length')
Here's a sample of a collection that failed to import.
{
"id": "5eb54264-f906-b6d7-9ee4-d045875c8ad4",
"name": "SO Test",
"order": [
"ee9c4b31-f6b3-0799-5d9d-298d8257d6d0",
"513b4473-f1c3-469e-ce67-edaf33faf2d0"
],
"timestamp": 1448497158415,
"requests": [
{
"id": "513b4473-f1c3-469e-ce67-edaf33faf2d0",
"url": "http://stackoverflow.com/questions/33901145/importing-postman-collection-fails?noredirect=1#comment55564842_33901145",
"method": "GET",
"headers": "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\nUpgrade-Insecure-Requests: 1\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.69 Safari/537.36\nAccept-Encoding: gzip, deflate, sdch\nAccept-Language: en-US,en;q=0.8\nCookie: prov=41dcce2f-3878-4f81-b102-86ced2fc0edd; __qca=P0-107192378-1422497046148; gauthed=1; _ga=GA1.2.828174835.1422497046; __cfduid=df57f13c8f66daf4cca857b9bde72d0981447728327\n",
"data": null,
"dataMode": "params",
"version": 2,
"name": "http://stackoverflow.com/questions/33901145/importing-postman-collection-fails?noredirect=1#comment55564842_33901145",
"description": "",
"descriptionFormat": "html",
"collectionId": "5eb54264-f906-b6d7-9ee4-d045875c8ad4"
},
{
"id": "ee9c4b31-f6b3-0799-5d9d-298d8257d6d0",
"url": "http://stackoverflow.com/posts/33901145/ivc/2e31?_=1448497117271",
"method": "GET",
"headers": "Accept: */*\nX-Requested-With: XMLHttpRequest\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.69 Safari/537.36\nReferer: http://stackoverflow.com/questions/33901145/importing-postman-collection-fails?noredirect=1\nAccept-Encoding: gzip, deflate, sdch\nAccept-Language: en-US,en;q=0.8\nCookie: prov=41dcce2f-3878-4f81-b102-86ced2fc0edd; __qca=P0-107192378-1422497046148; gauthed=1; _ga=GA1.2.828174835.1422497046; __cfduid=df57f13c8f66daf4cca857b9bde72d0981447728327\n",
"data": null,
"dataMode": "params",
"version": 2,
"name": "http://stackoverflow.com/posts/33901145/ivc/2e31?_=1448497117271",
"description": "",
"descriptionFormat": "html",
"collectionId": "5eb54264-f906-b6d7-9ee4-d045875c8ad4"
}
]
}
This bug was due to passing an empty body incorrectly:
"data": null,
"dataMode": "params",
It has been fixed in v1.1.2
Related
I am trying to populating an empty field by using patch method in Contentful. The following piece of code works in one cloned environment but does not work in another.
let patchData: OpPatch[] = [
{
op: 'replace',
path: '/fields/keywords',
value: entryKeyword,
},
];
await cmaClient.entry.patch({ entryId: entryId }, patchData, { 'X-Contentful-Version': entryVersion });
When I try to execute this, receiving a 'Unprocessable Entity' error:
UnprocessableEntity: {
"status": 422,
"statusText": "Unprocessable Entity",
"message": "Could not apply patch to entry: invalid patch",
"details": {},
"request": {
"url": "/spaces/xyz/environments/abc/entries/123456789",
"headers": {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json-patch+json",
"X-Contentful-User-Agent": "sdk contentful-management-plain.js/7.54.2;",
"Authorization": "Bearer ...",
"user-agent": "node.js/v14.19.2",
"Accept-Encoding": "gzip",
"X-Contentful-Version": 25,
"Content-Length": 78
},
"method": "patch",
"payloadData": "[{\"op\":\"replace\",\"path\":\"/fields/keywords\",\"value\":\"test keyword\"}]"
},
"requestId": "abcd-123456"
}
I have the same exact access permissions to both environments. What am I missing out on?
I had the same issue - turned out when the entry doesn't have the filed you're trying to patch - it will throw an error like above.
I am trying to send a request from my front-end to my back-end comprised of Java Servlets but for some reason GCP receives the request as an OPTIONS type instead of a PUT or DELETE and then none of the functionality or logging works, GET and POST work fine.
{
"protoPayload": {
"#type": "type.googleapis.com/google.appengine.logging.v1.RequestLog",
"appId": "g~servletcoursework-336513",
"versionId": "20211231t193717",
"requestId": "61cf5ebf00ff0c34825de6b9a60001677e736572766c6574636f75727365776f726b2d3333363531330001323032313132333174313933373137000100",
"ip": "84.70.147.60",
"startTime": "2021-12-31T19:49:19.801880Z",
"endTime": "2021-12-31T19:49:19.814140Z",
"latency": "0.012260s",
"method": "OPTIONS",
"resource": "/deleteFilm?format=xml&id=10001",
"httpVersion": "HTTP/1.1",
"status": 200,
"responseSize": "68",
"referrer": "https://d2icepsfo58cxr.cloudfront.net/",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36",
"urlMapEntry": "unused",
"host": "servletcoursework-336513.nw.r.appspot.com",
"cost": 7.598999999999999e-9,
"instanceIndex": -1,
"finished": true,
"instanceId": "00c61b117c8704a9c5c71617a78aab0d6d5dd3630b836d3885a5565c92e147a58efbc9180d22c59db107f4946306db18bbe33383d93470f26dada4e4acbd199e9d276494d392ba7d0b",
"appEngineRelease": "1.9.71",
"traceId": "0184c35a91f8e703c73e9f79e6a522e6",
"first": true,
"traceSampled": true
},
"insertId": "61cf5ebf000c6cc558e7834c",
"httpRequest": {
"status": 200
},
"resource": {
"type": "gae_app",
"labels": {
"zone": "europe-west2-2",
"project_id": "servletcoursework-336513",
"version_id": "20211231t193717",
"module_id": "default"
}
},
"timestamp": "2021-12-31T19:49:19.801880Z",
"labels": {
"clone_id": "00c61b117c8704a9c5c71617a78aab0d6d5dd3630b836d3885a5565c92e147a58efbc9180d22c59db107f4946306db18bbe33383d93470f26dada4e4acbd199e9d276494d392ba7d0b"
},
"logName": "projects/servletcoursework-336513/logs/appengine.googleapis.com%2Frequest_log",
"operation": {
"id": "61cf5ebf00ff0c34825de6b9a60001677e736572766c6574636f75727365776f726b2d3333363531330001323032313132333174313933373137000100",
"producer": "appengine.googleapis.com/request_id",
"first": true,
"last": true
},
"trace": "projects/servletcoursework-336513/traces/0184c35a91f8e703c73e9f79e6a522e6",
"receiveTimestamp": "2021-12-31T19:49:19.816277372Z",
"traceSampled": true
}
Yet if I do the same request via Postman it works completely fine:
{
"protoPayload": {
"#type": "type.googleapis.com/google.appengine.logging.v1.RequestLog",
"appId": "g~servletcoursework-336513",
"versionId": "20211231t193717",
"requestId": "61cf5f9300ff023d16e28dbc540001677e736572766c6574636f75727365776f726b2d3333363531330001323032313132333174313933373137000100",
"ip": "54.86.50.139",
"startTime": "2021-12-31T19:52:51.186694Z",
"endTime": "2021-12-31T19:52:51.227747Z",
"latency": "0.041053s",
"megaCycles": "4000",
"method": "DELETE",
"resource": "/deleteFilm?format=xml&id=10001",
"httpVersion": "HTTP/1.1",
"status": 200,
"responseSize": "195",
"userAgent": "PostmanRuntime/7.28.4",
"urlMapEntry": "unused",
"host": "servletcoursework-336513.nw.r.appspot.com",
"cost": 2.1792e-8,
"instanceIndex": -1,
"finished": true,
"instanceId": "00c61b117c8704a9c5c71617a78aab0d6d5dd3630b836d3885a5565c92e147a58efbc9180d22c59db107f4946306db18bbe33383d93470f26dada4e4acbd199e9d276494d392ba7d0b",
"appEngineRelease": "1.9.71",
"traceId": "4700825c5878ed9191d27216bd8b752a",
"first": true,
"traceSampled": true
},
"insertId": "61cf5f9300037a2457bd3063",
"httpRequest": {
"status": 200
},
"resource": {
"type": "gae_app",
"labels": {
"version_id": "20211231t193717",
"zone": "europe-west2-2",
"project_id": "servletcoursework-336513",
"module_id": "default"
}
},
"timestamp": "2021-12-31T19:52:51.186694Z",
"labels": {
"clone_id": "00c61b117c8704a9c5c71617a78aab0d6d5dd3630b836d3885a5565c92e147a58efbc9180d22c59db107f4946306db18bbe33383d93470f26dada4e4acbd199e9d276494d392ba7d0b"
},
"logName": "projects/servletcoursework-336513/logs/appengine.googleapis.com%2Frequest_log",
"operation": {
"id": "61cf5f9300ff023d16e28dbc540001677e736572766c6574636f75727365776f726b2d3333363531330001323032313132333174313933373137000100",
"producer": "appengine.googleapis.com/request_id",
"first": true,
"last": true
},
"trace": "projects/servletcoursework-336513/traces/4700825c5878ed9191d27216bd8b752a",
"receiveTimestamp": "2021-12-31T19:52:51.232339381Z",
"traceSampled": true
}
I have no idea why my HTTP request isn't working when it comes from my front-end, it was working fine when I tested locally. I have logging of different variables in order to debug my backend and it logs if I use postman but not if I send the request from my front-end.
It’s almost as if the (I assume) pre-flight requests breaks the behaviour of the Servlet I’m hitting, and I’m not sure how to fix this
how to use flurl to get the response body with query string parameters. I tried using Postman and the results were as I expected. but I can't apply it to flurl.
var strUrl = await "https://example.com/api/v2/xxx/yyy?need_personalize=true&promotionid=2007354722&sort_soldout=true"
.WithHeaders(new
{
user_agent = "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
content_type = "application/json",
referer = "https://example.com/xxx",
cookie = myCookies
})
.PostJsonAsync(new
{
need_personalize = true,
promotionid = 2007354722,
sort_soldout = true
});
bodyUrl = await strUrl.GetStringAsync();
the results I got : 200
{
"version": "6f1e0da21b667876ba3853b59a8bb812",
"error_msg": null,
"error": 10010
}
the resulting response should be like this :
{
"version": "6f1e0da21b667876ba3853b59a8bb812",
"data": {
"selling_out_item_brief_list": [
{
"itemid": 466536326,
"from": null
}
],
"items": [],
"mega_sale_items": [],
"item_brief_list": [
{
"itemid": 6720842242,
"from": null,
"is_soldout": false
}
],
"promotionid": 2007354722
},
"error_msg": null,
"error": 0
}
maybe anyone can help me?
I'm trying to filter out login events from the production_json.log of a Omnibus GitLab server.
Thus JSON elements that i want to filter look like this:
{
"method": "POST",
"path": "/users/sign_in",
"format": "html",
"controller": "SessionsController",
"action": "create",
"status": 302,
"duration": 146.22,
"view": 0,
"db": 16.64,
"location": "https://maschm.ddnss.de/",
"time": "2021-01-05T11:44:30.180Z",
"params": [
{
"key": "utf8",
"value": "✓"
},
{
"key": "authenticity_token",
"value": "[FILTERED]"
},
{
"key": "user",
"value": {
"login": "root",
"password": "[FILTERED]",
"remember_me": "0"
}
}
],
"remote_ip": "46.86.21.18",
"user_id": 1,
"username": "root",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15",
"queue_duration": 7.3,
"correlation_id": "JtnY93e2ti8"
}
I only want output for such elements.
jq is new to me. I'm using this command now:
sudo tail -f /var/log/gitlab/gitlab-rails/production_json.log |
jq --unbuffered '
if .remote_ip != null and .method == "POST" and
.path == "/users/sign_in" and .action == "create"
then
.ua + " " + .remote_ip else ""
end
'
The output looks like this:
""
""
""
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15 46.86.21.18"
""
""
""
""
""
""
I have two questions:
How can i avoid the "" output (there should be no output for other JSON elements)?
Is if the correct jq statement for filtering?
You could use empty instead of "" to solve the problem, but using select() to filter out unwanted stream elements is a cleaner solution.
jq --unbuffered '
select(
.remote_ip != null and
.method == "POST" and
.path == "/users/sign_in" and
.action == "create"
) |
.ua + " " + .remote_ip
'
I know that curl can post data to a URL:
$ curl -X POST http://httpbin.org/post -d "hello"
{
"args": {},
"data": "",
"files": {},
"form": {
"hello": ""
},
"headers": {
"Accept": "*/*",
"Content-Length": "5",
"Content-Type": "application/x-www-form-urlencoded",
"Host": "httpbin.org",
"User-Agent": "curl/7.50.1"
},
"json": null,
"origin": "64.238.132.14",
"url": "http://httpbin.org/post"
}
And I know I can pipe to curl to achieve the same thing:
$ echo "hello" | curl -X POST http://httpbin.org/post -d #-
{
"args": {},
"data": "",
"files": {},
"form": {
"hello": ""
},
"headers": {
"Accept": "*/*",
"Content-Length": "5",
"Content-Type": "application/x-www-form-urlencoded",
"Host": "httpbin.org",
"User-Agent": "curl/7.50.1"
},
"json": null,
"origin": "64.238.132.14",
"url": "http://httpbin.org/post"
}
Now here is where it gets tricky. I know about http transfer-coding and chunking, for example to send a multiline file:
('silly' is a file that contains several lines of text, as seen here)
$ cat silly | curl -X POST --header "Transfer-Encoding: chunked" "http://httpbin.org/post" --data-binary #-
{
"args": {},
"data": "",
"files": {},
"form": {
"hello\nthere\nthis is a multiple line\nfile\n": ""
},
"headers": {
"Accept": "*/*",
"Content-Length": "41",
"Content-Type": "application/x-www-form-urlencoded",
"Host": "httpbin.org",
"User-Agent": "curl/7.50.1"
},
"json": null,
"origin": "64.238.132.14",
"url": "http://httpbin.org/post"
}
Now what I want to be able to do is to have curl read a line from stdin, send it as a chunk, and then come back and read stdin again (which allows me to keep it going continously). This was my first attempt:
curl -X POST --header "Transfer-Encoding: chunked" "http://httpbin.org/post" -d #-
And it does work ONE TIME ONLY when I hit ctrl-D, but that obviously ends the execution of curl.
Is there any way to tell curl "Send (using chunk encoding) what I've given you so far, and then come back to stdin for more" ?
Thanks so much, I've been scratching my head for a while on this one!