# Trouble with GET in script

**URL:** <https://community.fibery.io/t/trouble-with-get-in-script/4428>\
**Category:** API & Programming\
**Created:** [May 8, 2023, 1:27pm UTC](https://community.fibery.io/t/trouble-with-get-in-script/4428 "2023-05-08T13:27:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sarah\_Arminta](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/sarah_arminta/32/4915_2.png) [@Sarah\_Arminta](https://community.fibery.io/u/Sarah_Arminta)\
**Post date:** [May 8, 2023, 1:27pm UTC](https://community.fibery.io/t/trouble-with-get-in-script/4428/1 "2023-05-08T13:27:24Z")

</div>

I’m dipping my toe into scripting in automations and I’m having trouble with a simple script. I can’t seem to get a response even though the script works fine in postman. What am I doing wrong?

const http = context.getService(‘http’);

try {  
// GET request to auth endpoint  
const response = await http.getAsync(‘[https://readwise.io/api/v2/auth/](https://readwise.io/api/v2/auth/)’, {  
headers: {  
‘Authorization’: ‘Token XXX’  
}  
});

```
// Throw an error with the response status to check if the request was successful
throw new Error("Readwise API response status: " + response.status);

```

} catch (error) {  
// If there’s an error, throw it to display in the Fibery app  
throw new Error(error);  
}

Here’s the error: Failed to execute Action “Script”: Error: Readwise API response status: undefined

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [May 8, 2023, 1:31pm UTC](https://community.fibery.io/t/trouble-with-get-in-script/4428/2 "2023-05-08T13:31:33Z")

</div>

Don’t tell everyone, but we will shortly release a readwise integration 😉

---

<div class="post-metadata">

**Author:** ![Sarah\_Arminta](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/sarah_arminta/32/4915_2.png) [@Sarah\_Arminta](https://community.fibery.io/u/Sarah_Arminta)\
**Post date:** [May 8, 2023, 1:37pm UTC](https://community.fibery.io/t/trouble-with-get-in-script/4428/3 "2023-05-08T13:37:56Z")

</div>

👀👀👀 🤩

In the meantime, any advice on what I’m doing wrong? For my other projects.

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [May 8, 2023, 8:49pm UTC](https://community.fibery.io/t/trouble-with-get-in-script/4428/4 "2023-05-08T20:49:55Z")

</div>

Basic script debugging tip: Start by creating a BUTTON for your script, because you’ll be able to see `console.log` outputs in your browser’s DevTools console.

When it’s working, move it to a Rule.
