Skip to content

Conversation

@JohnCari
Copy link
Contributor

@JohnCari JohnCari commented Dec 28, 2025

Summary

Add api_key_name support to HubSpot FDW, enabling Vault secret lookup by name for environment-agnostic configuration.

This PR includes the complete infrastructure to support api_key_name in WASM-based FDWs:

Infrastructure Changes (enables feature for all WASM FDWs)

  • Add get-vault-secret-by-name function to WIT interface (v1 and v2)
  • Implement host-side binding to call native get_vault_secret_by_name

HubSpot FDW Changes

  • Add api_key_name option to HubSpot FDW authentication
  • Follow Stripe FDW implementation pattern
  • Update documentation with examples
  • Add note clarifying that api_key accepts Private App Access Tokens (HubSpot deprecated legacy API Keys in November 2022)

Changes

File Description
wasm-wrappers/wit/v1/utils.wit Add get-vault-secret-by-name to WIT interface
wasm-wrappers/wit/v2/utils.wit Add get-vault-secret-by-name to WIT interface
wrappers/src/fdw/wasm_fdw/host/utils.rs Implement host-side function
wasm-wrappers/fdw/hubspot_fdw/src/lib.rs Add api_key_name support
docs/catalog/hubspot.md Document new option and clarify Private App Token auth

Testing

  • Verified backward compatibility with api_key and api_key_id
  • Verified precedence order: api_key > api_key_id > api_key_name

Benefits

Using api_key_name enables environment-agnostic configuration - the same SQL works across dev, staging, and production as long as each environment has a Vault secret with the same name.

Fixes #437

Relates to #461 (adds documentation clarifying that api_key accepts Private App Access Tokens, not the deprecated legacy API Keys)

## Summary
Add `api_key_name` support to HubSpot FDW, enabling Vault secret lookup by name for environment-agnostic configuration.

### Infrastructure Changes (enables feature for all WASM FDWs)
- Add `get-vault-secret-by-name` function to WIT interface (v1 and v2)
- Implement host-side binding to call native `get_vault_secret_by_name`

### HubSpot FDW Changes
- Add `api_key_name` option to HubSpot FDW authentication
- Follow Stripe FDW implementation pattern
- Update documentation with examples

Fixes supabase#437
Add note explaining that HubSpot deprecated their legacy API Keys in
November 2022 and that the api_key option accepts Private App Access
Tokens, which is HubSpot's recommended authentication method.

This helps address confusion reported in supabase#461.
- Remove `.cloned()` call on Option<String> (already owned)
- Pass &key_id and &key_name to get_vault_secret functions (expects &str)
@burmecia
Copy link
Member

Thanks @JohnCari for the PR! It's very cool feature 👍 , we will need a bit more time to do comprehensive testing on it.

@JohnCari
Copy link
Contributor Author

Thanks @JohnCari for the PR! It's very cool feature 👍 , we will need a bit more time to do comprehensive testing on it.

No problem @burmecia do you have any issue you can recommend me to tackle? im asking to prevent any duplicate of work

@burmecia
Copy link
Member

Thanks @JohnCari for the PR! It's very cool feature 👍 , we will need a bit more time to do comprehensive testing on it.

No problem @burmecia do you have any issue you can recommend me to tackle? im asking to prevent any duplicate of work

not much at this moment, but if you have any good ideas just feel free to raise issue or PR. Thanks again for your excellent work!

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

Successfully merging this pull request may close these issues.

Allow api_key_name for Hubspot

2 participants