[GH-ISSUE #5234] [feature]:Handle non-string values in 'pw.env.set', add error logs for pre/post-request scripts #1996

Open
opened 2026-03-16 22:48:13 +03:00 by kerem · 0 comments
Owner

Originally created by @kzkvv on GitHub (Jul 9, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5234

Is there an existing issue for this?

  • I have searched the existing issues

Summary

Hello! Just moved from postman to hoppscotch and found a strange behaviour: unknown error when I try to take a variable from json response and save it to env variable. Example:

Image

Response:
{ "id": 4065 }

And the reason is 'id' in response is a number. After I wrapped it with "String(res.id)" this error was resolved.

Image

After that i have 2 suggestions:

  1. Looks like it will be great to wrap the 2nd arg of pw.env.set method with "String" and accept any kind of variables (boolean/number/...). Because I found the solution only after I manually put a number as the 2nd arg. Or if it's expected behaviour can I contribute and add this solution to the official docs?
Image
  1. It will be very helpful to show any error logs for scripts. Even raw logs with stacktrace. It will help with future pre/post-request scripts debug sessions :)

Why should this be worked on?

  1. This case is one of the most popular I guess
  2. This feature will help in future pre/post-request scripts debug sessions
Originally created by @kzkvv on GitHub (Jul 9, 2025). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5234 ### Is there an existing issue for this? - [x] I have searched the existing issues ### Summary Hello! Just moved from postman to hoppscotch and found a strange behaviour: unknown error when I try to take a variable from json response and save it to env variable. Example: <img width="764" height="354" alt="Image" src="https://github.com/user-attachments/assets/bf7012db-e5ad-4619-b400-fe5c81e85bf6" /> Response: `{ "id": 4065 }` And the reason is 'id' in response is a number. After I wrapped it with "String(res.id)" this error was resolved. <img width="769" height="313" alt="Image" src="https://github.com/user-attachments/assets/68430043-17f4-4ce2-ae6a-8c334069497f" /> After that i have 2 suggestions: 1) Looks like it will be great to wrap the 2nd arg of `pw.env.set` method with "String" and accept any kind of variables (boolean/number/...). Because I found the solution only after I manually put a number as the 2nd arg. Or if it's expected behaviour can I contribute and add this solution to the official docs? <img width="476" height="92" alt="Image" src="https://github.com/user-attachments/assets/3bbabce6-b22e-4ebc-9804-ce1967a2f7b7" /> 2) It will be very helpful to show any error logs for scripts. Even raw logs with stacktrace. It will help with future pre/post-request scripts debug sessions :) ### Why should this be worked on? 1) This case is one of the most popular I guess 2) This feature will help in future pre/post-request scripts debug sessions
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1996
No description provided.