JSON javascript fetch response to my column using QueryJson

Hi,
Can someone help me to parse a Json response from a Javascript fetch column (using await fetch). I can see the response only in chrome but not at the Javascript column that send request. The response are ok and Json. After copy&paste the response in a Text column and get with QueryJson. It’s works, but I can’t make it direct from Javascript column.

Javascript Column > QueryJson column not working (but response in chrome nav are there)
Javascript Column > Text Column manually > QueryJson is OK
Thanks

Can you show me what you got in your js column?

const PAT = ‘KEY’;
const USER_ID = ' i';       
const APP_ID = 'main';
const MODEL_ID = 'item-v1';
const MODEL_VERSION_ID = '';    
const IMAGE_URL = 'https://samples.jpg';

const raw = JSON.stringify({
    "user_app_id": {
        "user_id": USER_ID,
        "app_id": APP_ID
    },
    "inputs": [
        {
            "data": {
                "image": {
                    "url": IMAGE_URL
                }
            }
        }
    ]
});
const requestOptions = {
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Authorization': 'Key ' + PAT
    },
    body: raw
};
await fetch("https://model.com/v2/models/" + MODEL_ID + "/versions/" + MODEL_VERSION_ID + "/outputs", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

Change this to this:

try {
const res = await fetch("https://model.com/v2/models/" + MODEL_ID + "/versions/" + MODEL_VERSION_ID + "/outputs", requestOptions);
const data = await res.text();
return data;
}
catch(e) {
return `Error Message you want! You can also add error message and stack trace: ${e.stackTrace}`;
}

Now is passing data to the Javascript column but I have a new problem with CORS backside during the post event, It’s not accepting my request or response. He demand use a CORS ?
I tested with ‘Access-Control-Allow-Origin’ : ‘*’ but nothing always is blocking

By the way 2 questions:

Did you try with Call API action?

Is the PAT key Private or have a lot of access to your model.com’s account? I am asking that because if it is, you are exposing it by using front end code (JavaScript). The Call API action store the secret in the back-end.

Hi,
I understand the limitations but I’m not very rich at the moment to try others methods, I need call APIs with the poor method. May be others methods exist but I have some limitations to discovers quickly (virtual machines, personal cloud or vps). I would prefer a pay option based on a counter like others.

I recognize the limitations, but I’m currently not in a financial position to explore other methods. I need to use APIs with the limited option available. While there may be other methods, my ability to discover them is restricted (virtual machines, personal clouds, or VPS). I would prefer a paid option based on usage, similar to others inclued in free testing package. Regards

CORS, I can use external cors web pages but exist some way to fix in my javascript code that works ? Thanks