[GH-ISSUE #4896] [feature]: Add option to scripts to save variables in Global Environment #1841

Open
opened 2026-03-16 22:02:31 +03:00 by kerem · 1 comment
Owner

Originally created by @emanuel-achirei-deel on GitHub (Mar 17, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4896

Is there an existing issue for this?

  • I have searched the existing issues

Summary

I'm using Tests to generate variable values to use in a subsequent request. Currently I'm saving using pw.env.set. However, this saves them in the Workspace Environment, which makes them shared accross users, and this could create issues if those requests are run in parallel by different users.

Why should this be worked on?

The use-case is generating a signed URL for S3 and then uploading a file. I'm sure there are other cases like this one. I've seen other solutions, where you can directly reference the value from a response in the request parameters, but given that might be more difficult to implement, an option to choose which environment to set when calling pw.env.set might be a good middle ground.

Originally created by @emanuel-achirei-deel on GitHub (Mar 17, 2025). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4896 ### Is there an existing issue for this? - [x] I have searched the existing issues ### Summary I'm using Tests to generate variable values to use in a subsequent request. Currently I'm saving using `pw.env.set`. However, this saves them in the Workspace Environment, which makes them shared accross users, and this could create issues if those requests are run in parallel by different users. ### Why should this be worked on? The use-case is generating a signed URL for S3 and then uploading a file. I'm sure there are other cases like this one. I've seen other solutions, where you can directly reference the value from a response in the request parameters, but given that might be more difficult to implement, an option to choose which environment to set when calling pw.env.set might be a good middle ground.
Author
Owner

@jamesgeorge007 commented on GitHub (Oct 3, 2025):

Hi, we've introduced a hopp namespace housing new scripting methods as proposed in https://github.com/hoppscotch/hoppscotch/discussions/5221 with the ability to manage global environment variables from the scripting context.

It's not recommended to migrate or rework your existing scripts for the new scripting APIs just yet. Breaking changes are expected as the system evolves.

The rollout is intentionally gradual to gather feedback and refine based on real-world use. All future changes will be scoped to the experimental scripting sandbox (enabled by default; can be toggled in Settings → Experiments). Please feel free to take it for a spin and let us know your feedback via the RFC above.

<!-- gh-comment-id:3364715878 --> @jamesgeorge007 commented on GitHub (Oct 3, 2025): Hi, we've introduced a `hopp` namespace housing new [scripting methods](https://docs.hoppscotch.io/documentation/features/scripts#hopp-%5Bexperimental%5D) as proposed in https://github.com/hoppscotch/hoppscotch/discussions/5221 with the ability to manage [global environment variables](https://docs.hoppscotch.io/documentation/features/scripts#global-environment-scope) from the scripting context. It's not recommended to migrate or rework your existing scripts for the new scripting APIs just yet. Breaking changes are expected as the system evolves. The rollout is intentionally gradual to gather feedback and refine based on real-world use. All future changes will be scoped to the experimental scripting sandbox (enabled by default; can be toggled in `Settings → Experiments`). Please feel free to take it for a spin and let us know your feedback via the RFC above.
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#1841
No description provided.