# Code node not working on N8N cloud

**URL:** <https://community.n8n.io/t/code-node-not-working-on-n8n-cloud/69850>\
**Category:** Questions\
**Created:** [January 9, 2025, 5:40pm UTC](https://community.n8n.io/t/code-node-not-working-on-n8n-cloud/69850 "2025-01-09T17:40:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aizad\_eng](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/aizad_eng/32/53239_2.png) [@aizad\_eng](https://community.n8n.io/u/aizad_eng)\
**Post date:** [January 9, 2025, 5:40pm UTC](https://community.n8n.io/t/code-node-not-working-on-n8n-cloud/69850/1 "2025-01-09T17:40:59Z")

</div>

Hey, I am running a simple http request via code node in n8n but its not working, the same code node is working on another n8n instance but in my current instance its not working

N8N cloud I am using  
Version: 1.72.1

```auto
const items = [];
const apiKey = 'API KEY'; // Replace with your actual API key
const limit = 10; // Max value allowed is 100

// Function to fetch data from the API using n8n's request helper
async function fetchData() {
  try {
    const endpoint = 'https://server.smartlead.ai/api/v1/email-accounts/';
    const queryString = `?api_key=${apiKey}&limit=${limit}`;

    const response = await this.helpers.request({
      method: 'GET',
      url: endpoint + queryString,
      headers: {
        'Content-Type': 'application/json',
      },
    });

    // Log the data for this API call
    console.log('API Call response:', response);

    return response; // Assuming the response is an array of objects
  } catch (error) {
    console.log('Error encountered during fetch:', error.message);
    return []; // Return an empty array in case of an error
  }
}

// Fetch the data and log the result
const response = await fetchData();
console.log('Fetched items:', response);

// Return the items in the correct format for n8n
return response.map(item => ({ json: item }));

```

Error - It is saying fetch is not available, HTTP is not available, like how do we make a HTTP request if literally we cant use any lib? I am using the HTTP and helper lib in other cloud instance and its working fine but same code does not work on my new cloud instance.

Help!!!

---

<div class="post-metadata">

**Author:** ![n8n](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/n8n/32/196425_2.png) [@n8n](https://community.n8n.io/u/n8n)\
**Post date:** [January 9, 2025, 5:41pm UTC](https://community.n8n.io/t/code-node-not-working-on-n8n-cloud/69850/2 "2025-01-09T17:41:00Z")

</div>

It looks like your topic is missing some important information. Could you provide the following if applicable.

- **n8n version:**
- **Database (default: SQLite):**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):**
- **Running n8n via (Docker, npm, n8n cloud, desktop app):**
- **Operating system:**

---

<div class="post-metadata">

**Author:** ![ihortom](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ihortom/32/11473_2.png) [@ihortom](https://community.n8n.io/u/ihortom)\
**Post date:** [January 9, 2025, 10:47pm UTC](https://community.n8n.io/t/code-node-not-working-on-n8n-cloud/69850/3 "2025-01-09T22:47:56Z")

</div>

Welcome to the community @aizad_eng !

> **Tip for sharing information**
>
> #### Pasting your n8n workflow
> 
> * * *
> 
> Ensure to copy your n8n workflow and paste it in the _code block_, that is in between the pairs of triple backticks, which also could be achieved by clicking `</>` (preformatted text) in the editor and pasting in your workflow.
> 
> ```  
> \<your workflow\>  
> ```
> 
> That implies to any JSON output you would like to share with us.
> 
> Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!
> 
> * * *

May I ask why you use Code node instead of HTTP Request node for this task? Also, I checked your email address and couldn’t find your n8n Cloud account. What is your n8n workspace ID?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [April 9, 2025, 10:48pm UTC](https://community.n8n.io/t/code-node-not-working-on-n8n-cloud/69850/4 "2025-04-09T22:48:36Z")

</div>

Closed on April 9, 2025, 10:48pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
