Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HubSpot Serverless Functions not passing correct status codes during local development #95

Open
noerbot opened this issue Dec 5, 2024 · 0 comments

Comments

@noerbot
Copy link

noerbot commented Dec 5, 2024

We set up some serverless functions following the example from this repo, but when I test a React module that uses one of our serverless functions locally via npm start, it always seems to receive a 200 OK status code even when the serverless function returns a 400 or 404.

You can see in the serverless logs that it's returning the correct status code:
image

But I always receive a 200 status code locally:
image

Based on the output in my terminal, it looks like these requests are running through a proxy:

attempting to proxy a POST serverless request to domain: 46512223.hs-sites.com for resource: /hs/serverless/create-user ...

I'm guessing that the proxy is just incorrectly converting everything to 200 for some reason. This makes building error handling for specific status codes very difficult, as I can't test the results locally. Even when I use the http://hslocal.net:3000/proxy?page= approach using a published page that includes my module, the same issue occurs.

The only way I can test status codes currently is if I deploy everything to Hubspot, but that's a super clunky DX.

Hoping someone can help! Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant