HAC DevOps & Deployment 3 — Questions and Answers
Question 1: When using HubSpot Projects (developer projects), what does the `hs project deploy` command do?
- Pushes local files to the design manager only
- Builds and deploys serverless functions and CRM extensions defined in the project (Correct answer)
- Publishes all draft blog posts in the portal
- Refreshes the CDN cache across all pages
Correct answer: Builds and deploys serverless functions and CRM extensions defined in the project
`hs project deploy` compiles and deploys serverless functions, CRM cards, and other project components to the connected portal.
Question 2: What is the maximum execution timeout for a HubSpot serverless function?
- 5 seconds
- 10 seconds
- 30 seconds (Correct answer)
- 60 seconds
Correct answer: 30 seconds
HubSpot serverless functions have a hard timeout of 30 seconds per execution.
Question 3: A HubSpot serverless function needs to access a private API key. What is the recommended way to store and reference it?
- Hard-code it in the function's JavaScript file
- Store it as a secret using `hs secrets add` and reference it via `process.env` (Correct answer)
- Save it to a HubDB table with restricted access
- Embed it in the hubspot.config.yml file
Correct answer: Store it as a secret using `hs secrets add` and reference it via `process.env`
HubSpot Secrets are encrypted environment variables added via CLI and accessed in functions through `process.env.SECRET_NAME`.
Question 4: Which HTTP methods are supported by HubSpot serverless function endpoints?
- GET only
- GET and POST only
- GET, POST, PUT, and DELETE (Correct answer)
- All standard HTTP methods including PATCH and OPTIONS
Correct answer: GET, POST, PUT, and DELETE
HubSpot serverless functions support GET, POST, PUT, and DELETE request methods.
Question 5: In a HubSpot developer project, where are serverless functions defined relative to the project folder structure?
- In the `/templates` directory
- In a `.functions` folder within the project (Correct answer)
- In the `/src/functions` directory
- Directly in the project root as `.js` files
Correct answer: In a `.functions` folder within the project
Serverless functions reside inside a `.functions` directory which contains both the function JS files and a `serverless.json` config.
Question 6: What does the `serverless.json` file inside a `.functions` folder define?
- The npm packages to install before deployment
- The endpoint paths and which function files handle each route (Correct answer)
- The HubSpot portal credentials for the deployment
- The caching TTL for each serverless response
Correct answer: The endpoint paths and which function files handle each route
`serverless.json` maps URL endpoint paths to their corresponding function handler files and specifies allowed HTTP methods.
Question 7: When a HubSpot CRM card (UI extension) is deployed via `hs project deploy`, where does it appear for end users?
- In the HubSpot App Marketplace listing
- On CRM record pages as a custom sidebar or middle panel card (Correct answer)
- In the HubSpot reporting dashboard
- As a custom tab in the portal's Settings menu
Correct answer: On CRM record pages as a custom sidebar or middle panel card
CRM cards appear as custom UI panels on Contact, Company, Deal, or Ticket record pages in the CRM.
When using HubSpot Projects (developer projects), what does the `hs project deploy` command do?