SetEnvironmentVariablw Not Working
Mik39907 opened this issue · comments
followed issue 76 video and I can get console.log(responseData.theaccesstoken)
shows correct token
but I can't set it to environment
context.response.setEnvironmentVariable('MyAccessToken', responseData.theaccesstoken)
no errors thrown and if I wrap that set with console.log shows as undefined
I have tried with new and already existing Variable Names neither work
Version 0.3.2 (ad16d94)
Hi @Mik39907, can you paste your full plugin script here?
function handleResponse() {
const response = context.response.getBodyText()
const responseData = JSON.parse(response)
// console.log(responseData.Token)
context.response.setEnvironmentVariable('MyToken', responseData.Token)
}
and the rest is the default
That seems perfectly fine. Is there any possibility you can paste your environment here? With the sensitive info redacted. Let me check and see if I can reproduce the issue with the same script and environment.
By the way, in which environment are you checking if the value is set? The value will be set in the workspace environment, which is the option available at the top of the nav bar. It won't be set on the environment option that's available when you right click on a request folder.
ok that's the issue I was checking at the folders
nevermind thx