[X] I've searched existing issues and found nothing related to my issue.
Describe the bug
Description:
I'm encountering an issue in Bruno where variables set within the pre-request script remain unresolved in the requests. Despite correctly implementing the script to generate and set these variables, they are not being recognized when referenced in the request no matter which level they're in (collection, folder, request).
Steps to Reproduce:
Pre-Request Script:
const { nanoid } = require('nanoid'); // Import nanoid function
const moment = require('moment'); // Import moment.js library
// Generate a unique message ID and set it as a variable
bru.setVar("UniqueMsgID", nanoid());
// Capture the current date/time in ISO 8601 format and set it as a variable
bru.setVar("CurInstISO", moment().format('YYYY-MM-DDTHH:mm:ss.SSSZ'));
// Capture the current date/time in HL7v2 format and set it as a variable
bru.setVar("CurInstHL7v2", moment().format('YYYYMMDDHHmmss'));
Expected Behavior:
The variables UniqueMsgID, CurInstISO, and CurInstHL7v2 should be correctly set in the pre-request script and their values should be accessible and resolved when referenced in the request headers.
Actual Behavior:
The variables remain unresolved in the request headers, resulting in empty or undefined values being sent.
Additional Information:
I have verified that the bru object is properly initialized and that the bru.setVar function is available in the scripting context.
The nanoid and moment libraries are correctly installed and imported.
The variables are set before the request is sent.
Environment:
Bruno Version: 1.28 and 1.34.2
Operating System: Windows 11
Request:
Assistance in resolving this issue would be greatly appreciated. If additional information is required, please let me know.
I have checked the following:
Describe the bug
Description:
I'm encountering an issue in Bruno where variables set within the pre-request script remain unresolved in the requests. Despite correctly implementing the script to generate and set these variables, they are not being recognized when referenced in the request no matter which level they're in (collection, folder, request).
Steps to Reproduce:
Pre-Request Script: const { nanoid } = require('nanoid'); // Import nanoid function const moment = require('moment'); // Import moment.js library
// Generate a unique message ID and set it as a variable bru.setVar("UniqueMsgID", nanoid());
// Capture the current date/time in ISO 8601 format and set it as a variable bru.setVar("CurInstISO", moment().format('YYYY-MM-DDTHH:mm:ss.SSSZ'));
// Capture the current date/time in HL7v2 format and set it as a variable bru.setVar("CurInstHL7v2", moment().format('YYYYMMDDHHmmss'));
Expected Behavior: The variables UniqueMsgID, CurInstISO, and CurInstHL7v2 should be correctly set in the pre-request script and their values should be accessible and resolved when referenced in the request headers.
Actual Behavior: The variables remain unresolved in the request headers, resulting in empty or undefined values being sent.
Additional Information: I have verified that the bru object is properly initialized and that the bru.setVar function is available in the scripting context. The nanoid and moment libraries are correctly installed and imported. The variables are set before the request is sent.
Environment:
Bruno Version: 1.28 and 1.34.2 Operating System: Windows 11 Request: Assistance in resolving this issue would be greatly appreciated. If additional information is required, please let me know.
.bru file to reproduce the bug
No response
Screenshots/Live demo link