Skip to content

chore: Mention setting function target env variable when starting dev server using ide #266

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ handling logic.
)

func main() {
// The local development server is normally started from the command line, but
// certain IDE's support directly running go applications from the IDE. In these
// cases, the function won't be recognized.
//
// To resolve, set the "FUNCTION_TARGET" env variable directly to ensure the
// function is registered for the local server.
//
// err := os.Setenv("FUNCTION_TARGET", "HelloWorld")
// if err != nil {
// log.Fatalf("failed to set FUNCTION_TARGET: %v\n for local dev server", err)
// }

// Use PORT environment variable, or default to 8080.
port := "8080"
if envPort := os.Getenv("PORT"); envPort != "" {
Expand Down