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

Make functions aware of their app #92

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

amh4r
Copy link
Contributor

@amh4r amh4r commented Feb 5, 2025

Description

This PR makes a handful of notable changes:

  • Move the app ID to the client.
  • CreateFunction accepts the client and returns an error.
  • NewHandler accepts the client.
  • Require function IDs to be explicit. Previously they were the slugified name.
  • The default client no longer exists. Instead, users must create one with NewClient.
  • Make Handler private.

These breaking changes are evident in this example file:
/~https://github.com/inngest/inngestgo/pull/92/files#diff-2bbb903e4dd6d4106cc1be9a7ba97c4f4d4a7eb08791721637e64bd30fd45718

Motivation

  • Fixes step.Send only using DefaultClient.
  • The compiler tells you that you need to create the client, rather than a runtime error telling you to set DefaultClient.
  • step.Invoke doesn't need to be given the app ID (it's implicitly on the invoked function).
  • Creating implicit function IDs by slugifying function names is problematic, as we found with v2 of the TypeScript SDK.

More generally, these changes align the Go SDK a little more with our other SDKs.

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.

1 participant