# What is absolute endpoint for CMS React serverless functions

**URL:** <https://community.hubspot.com/t/what-is-absolute-endpoint-for-cms-react-serverless-functions/123742>\
**Category:** APIs & Integrations\
**Tags:** developer-tools\
**Created:** [January 12, 2025, 2:58pm UTC](https://community.hubspot.com/t/what-is-absolute-endpoint-for-cms-react-serverless-functions/123742 "2025-01-12T14:58:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cyberwombat](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@cyberwombat](https://community.hubspot.com/u/cyberwombat)\
**Post date:** [January 12, 2025, 2:58pm UTC](https://community.hubspot.com/t/what-is-absolute-endpoint-for-cms-react-serverless-functions/123742/1 "2025-01-12T14:58:15Z")

</div>

I am trying to make a call from my CMS React project to a serverless endpoint. The same code is a relative URL which fails during testing.

Here’s my serverless.json

```lia-code-sample
{
 "appFunctions": {
 "loadItem": {
 "file": "out/loadItem.js",
 "endpoint": {
 "path": "loadItem",
 "method": ["GET"]
 }
 }
 }
}

```

I see two different url schemas in docs:

`//{domainName}/_hcms/api/loadItem`

and

`/hs/serverless/loadItem`

I am not sure what “domainName” is - this is a demo account. If I do ‘[hubspot.com](http://hubspot.com)’ then the respone says “The endpoint GET loadItem has not been configured for portal”

If I try the second one with “[hubspot.com](http://hubspot.com)” it yields

context: { PATH: [‘loadItem’], METHOD: [‘GET’] },  
category: ‘OBJECT\_NOT\_FOUND’,  
subCategory: ‘ServerlessGatewayErrorType.GATEWAY\_NOT\_FOUND’

Any idea what correct absolute endpoint is?

---

<div class="post-metadata">

**Author:** ![cyberwombat](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@cyberwombat](https://community.hubspot.com/u/cyberwombat)\
**Post date:** [January 13, 2025, 1:02am UTC](https://community.hubspot.com/t/what-is-absolute-endpoint-for-cms-react-serverless-functions/123742/2 "2025-01-13T01:02:54Z")

</div>

Answering my own question after testing. I got the URL of a landing page using the “copy link” button in the preview and used that domain with the `hs/serverless` path such as:

“`https://hubspot-demo-account-foo.hubspotpagebuilder.com/hs/serverless/myFuncEndpoint`”

---

<div class="post-metadata">

**Author:** ![cyberwombat](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@cyberwombat](https://community.hubspot.com/u/cyberwombat)\
**Post date:** [January 15, 2025, 5:36pm UTC](https://community.hubspot.com/t/what-is-absolute-endpoint-for-cms-react-serverless-functions/123742/3 "2025-01-15T17:36:13Z")

</div>

Adding a note that a GET request will work from the page builder but a POST will encounter CORS errors so you will need to preview the page (so `homepagebuilder.com`) to get it to work. If you do relative URL it should work in the preview but the absolute URL does allow GET from other domains such as local or page builder.

---

<div class="post-metadata">

**Author:** ![cyberwombat](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@cyberwombat](https://community.hubspot.com/u/cyberwombat)\
**Post date:** [January 15, 2025, 6:10pm UTC](https://community.hubspot.com/t/what-is-absolute-endpoint-for-cms-react-serverless-functions/123742/4 "2025-01-15T18:10:11Z")

</div>

Adding another note that if you are using SSR (getServerSideProps) to fetch then an absolute URL is necessary since the server doesnt’ have one.
