Javascript in sharedflow returns error

I have a Javascript attached in a shared flow that always returns an error when calling the proxy where the shared flow is attached.

In fact, it doesn't matter what I put in the JS file, I always get the following error in the Trace when the Javascript policy executes -


Execution of JavaScript-1 failed with error: Javascript runtime error: "null"

Here is my JS policy

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Javascript async="false" continueOnError="false" enabled="true" timeLimit="200" name="JavaScript-1">
    <DisplayName>JavaScript-1</DisplayName>
    <Properties/>
    <ResourceURL>jsc://JavaScript-1.js</ResourceURL>
</Javascript>

and here is the JS itself

//var origins = context.getVariable('virtualhost.aliases.values');
//context.setVariable('accessControlOrigin', origins[0]);
var v;

So its not about what I want to do in the Javascript but it's like the Shared Flow just doesn't like the JS for some reason.

What I'm trying to do is to get the Apigee virtualhost flow variable array and extract the first value from it and set it as the access-control-allow-origin header in my response headers.

0 1 223
1 REPLY 1

@dino-at-google can anyone provide some help with this?