Closed Niloo721 closed 2 years ago
Hey @Niloo721
The {{$guid}}
variable is a dynamically changing helper which gets created at runtime (when you send the request).
This isn't unique to that helper, you would see the same behaviour on the other dynamic helpers (For example {{$randomInt}}
)
The guid you sent with the request (The one in the console log) and the one in the snippets would always be different.
The only way that those would be the same is if you use either a hardcoded value or you store a value as a variable and reference that in the request.
Hey Danny, I understand what you say but in the previous version of Postman, we don't have this problem... and I think, one thing is changed because we use the guid in snippet and console log all the time and we don't have this problem before. Thank you for taking the time to respond to me
Which version would that have been?
I'm trying to think of a version that it would have worked in that way? 🤔
Hi, I don't remember what the previous version was but I'm sure we haven't had this problem before, and this has happened recently because we are monitoring the API every day and checking traceids in our logs, and it has been the case before.
Could you walk through the use case for me please and how the code snippets are part of the flow.
You mentioned monitoring which would not include the snippet generator but it does have a console which show the output.
I mean monitoring of API services not monitoring of postman! In the previous version when we get time out in API call, we used GUID snippet and we found it on the elastic log but now we can't find it. (according to the video below) and I haven't any solution to prove it.
If the correct guid that was sent in the request, is in the console log, why are you using the code snippet section to copy the value?
That guid could be logged to the console using:
console.log(pm.request.toJSON().url.query[0]['value'])
You could amend your request and add this to the pre-request:
pm.globals.set('traceId', pm.globals.replaceIn('{{$guid}}'))
Then update the variable used in the UI to {{traceId}}
.
This should then show the same guid in both places.
Ok I got it, thanks for your response
Is there an existing request for this feature?
Is your feature request related to a problem?
Because we are monitoring sensitive APIs using postman and often the API status is 504 error, we used traceid snippet to check for errors and searched our system logs. And before, we used the same method in previous versions of Postman, but the tracheids of this part are not in the logs of our system (we check we get traceid of the console log of Postman) and can only be seen in the log console. The difference between the dynamic variable generated by the Code snippet and the main sent request misled us. On the other hand, because we use Postman monitoring, the traceid of that part is different. This is something that is included in our system log and this has made it impossible for us to do our job. this bug is about the difference between GUID in code snippet and log. please check this scenario to reproduce and fix it:
Describe the solution you'd like
We like GUID to be no different in the code snippet and log .
Describe alternatives you've considered
No response
Additional context
1- This is happening on the desktop app and also on our web app. (attachment photo) 2- It happens with multiple different requests and collections. (attachment photo) 3- Postman version: Postman for Windows