# Page not found error displayed on browser for serverless function

**URL:** <https://community.hubspot.com/t/page-not-found-error-displayed-on-browser-for-serverless-function/38473>\
**Category:** APIs & Integrations\
**Tags:** cms-content, developer-tools, timeline-and-extensions-apis\
**Created:** [June 7, 2021, 9:07am UTC](https://community.hubspot.com/t/page-not-found-error-displayed-on-browser-for-serverless-function/38473 "2021-06-07T09:07:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DKachhawaha](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dkachhawaha/32/27794_2.png) [@DKachhawaha](https://community.hubspot.com/u/DKachhawaha)\
**Post date:** [June 7, 2021, 9:07am UTC](https://community.hubspot.com/t/page-not-found-error-displayed-on-browser-for-serverless-function/38473/1 "2021-06-07T09:07:40Z")

</div>

I referred link **[Get started with serverless functions - HubSpot docs](https://developers.hubspot.com/docs/cms/guides/getting-started-with-serverless-functions)** to create serverless function.

This is my **hubspot.config.yml:**

defaultPortal: HubSpot\_Assignment

portals:

- name: HubSpot\_Assignment

```
portalId: 8943172

authType: personalaccesskey

auth:

  tokenInfo:

    accessToken: >-

     XXX

    expiresAt: '2021-06-07T10:19:46.023Z'

personalAccessKey: >-

  XXX

```

My **congratulation.js** file is as follows:

exports.main = (context, sendResponse) =\> {

```
// your code called when the function is executed

const functionResponse = "Congrats! You've just deployed a Serverless Function."

// sendResponse is a callback function you call to send your response.

sendResponse({body: functionResponse, statusCode: 200});

```

};

I tried to access this url **[https://api.hubapi.com/\_hcms/api/congratulation](https://api.hubapi.com/_hcms/api/congratulation)**

But I am getting

Page Not Found Error

on Browser

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [June 7, 2021, 2:21pm UTC](https://community.hubspot.com/t/page-not-found-error-displayed-on-browser-for-serverless-function/38473/2 "2021-06-07T14:21:20Z")

</div>

Hi everyone! 👋

Just adding a quick update for anyone coming across this thread.

The original solution still applies: **CMS serverless functions should be accessed through a domain connected to your HubSpot account** , rather than `api.hubapi.com`.

For example, a CMS serverless endpoint would use a URL like:

`https://yourdomain.com/_hcms/api/your-endpoint`

Keep in mind that HubSpot’s serverless functionality has evolved since this discussion in 2021. Project-based serverless functions are also available in Developer Platform 2026.03, with a different endpoint structure and configuration.

For current setup instructions, I’d recommend checking HubSpot’s [serverless functions documentation](https://developers.hubspot.com/docs/cms/start-building/features/serverless-functions/overview).

Hope this helps anyone running into a similar issue! 😊

* * *

@DKachhawaha ,

You are loading the wrong address. It will be available under whatever domain your portal is using.

If your portal domain was [example.com](http://example.com), it would be `https://www.example.com>/_hcms/api/congratulation`

_Moderator Note: this post was reviewed for relevancy and optimized for clarity on October 23, 2026. Thank you for your contributions to the HubSpot Community!_

---

<div class="post-metadata">

**Author:** ![DKachhawaha](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dkachhawaha/32/27794_2.png) [@DKachhawaha](https://community.hubspot.com/u/DKachhawaha)\
**Post date:** [June 9, 2021, 8:41am UTC](https://community.hubspot.com/t/page-not-found-error-displayed-on-browser-for-serverless-function/38473/3 "2021-06-09T08:41:34Z")

</div>

Thanks for the solution.I am new to this platform.

Could you please tell me where can I find my domain name for my account.

And also the files which i created like javascript files or yml files are they to be created in IDE like VScode or in Design Manager of HubSpot Account

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [June 9, 2021, 3:43pm UTC](https://community.hubspot.com/t/page-not-found-error-displayed-on-browser-for-serverless-function/38473/4 "2021-06-09T15:43:14Z")

</div>

@DKachhawaha ,

This kb " [Understand and manage system domains](https://knowledge.hubspot.com/domains-and-urls/display-system-domains-in-domain-settings) " should get you to where your domain is located. If you haven’t set a domain up yet, when you get to the domains settings, it will be empty. Click on language settings and you will see it there.

As for the second question, I recommend using a local web development workflow when possible which I believe was advised in that doc that you referenced above. Here is another doc " [HubSpot CLI commands overview - HubSpot docs](https://developers.hubspot.com/docs/developer-tooling/local-development/hubspot-cli/reference) " that explores it in more detail.

Good luck!
