Skip to content

Fix JavaScript SyntaxError: add missing async in GitHub App webhook handler example - #47108

Open
ShakilUrRehman21 wants to merge 1 commit into
github:mainfrom
ShakilUrRehman21:fix/github-app-webhook-missing-async
Open

ShakilUrRehman21 wants to merge 1 commit into
github:mainfrom
ShakilUrRehman21:fix/github-app-webhook-missing-async

Conversation

@ShakilUrRehman21

Copy link
Copy Markdown
Contributor

Why:

In content/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation.md, the code sample demonstrating how to handle webhook events using app.webhooks.on("issues.opened", ...) uses await octokit.request(...) inside the callback arrow function.

However, the callback signature was not declared as async. When copying and running this code in Node.js, it immediately throws:

SyntaxError: await is only valid in async functions and the top level bodies of modules

This PR adds async to the callback parameters (async ({ octokit, payload }) => {), ensuring the tutorial example is syntactically valid and executable.

What's being changed:

  • Added async to the issues.opened webhook handler arrow function callback in content/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation.md.

Check off the following:

  • A subject matter expert (SME) has reviewed the technical accuracy of the content in this PR. In most cases, the author can be the SME. Open source contributions may require an SME review from GitHub staff.
  • The changes in this PR meet the docs fundamentals that are required for all content.
  • All CI checks are passing and the changes look good in the review environment.

Copilot AI lite review requested due to automatic review settings November 28, 2026 11:51
@github-actions

Copy link
Copy Markdown
Contributor

How to review these changes 👓

Thank you for your contribution. To review these changes, choose one of the following options:

A Hubber will need to deploy your changes internally to review.

Table of review links

Note: Please update the URL for your staging server or codespace.

The table shows the files in the content directory that were changed in this pull request. This helps you review your changes on a staging server. Changes to the data directory are not included in this table.

Source Review Production What Changed
apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation.md fpt
ghec
ghes@ 3.23 3.22 3.21 3.20 3.19
fpt
ghec
ghes@ 3.23 3.22 3.21 3.20 3.19

Key: fpt: Free, Pro, Team; ghec: GitHub Enterprise Cloud; ghes: GitHub Enterprise Server

🤖 This comment is automatically generated.

@github-actions github-actions Bot added the triage Do not begin working on this issue until triaged by the team label Nov 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change addresses the identified JavaScript issue by making the webhook callback asynchronous, with no remaining review issues indicated.

No open issues 🎉

What changed in this PR

This PR fixes the GitHub App webhook handler example by making its callback asynchronous so the existing await expression is valid JavaScript.

Changes:

  • Added async to the issues.opened webhook handler callback.
  • Preserved the existing authentication, API request, and documentation flow.
File Description
content/​apps/​creating-github-apps/​authenticating-with-a-github-app/​authenticating-as-a-github-app-installation.md Updates the webhook handler example to use an asynchronous callback for its existing API request.

Review effort: Lite

@bryanseb123-wq bryanseb123-wq left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • title: Access to package version deletion
    description: >-
    This preview adds support for the DeletePackageVersion mutation which
    enables deletion of private package versions.
    toggled_by: ':package-deletes-preview'
    announcement: null
    updates: null
    toggled_on:
    • Mutation.deletePackageVersion
      owning_teams:
    • '@github/pe-package-registry'
  • title: Deployments
    description: >-
    This preview adds support for deployments mutations and new deployments
    features.
    toggled_by: ':flash-preview'
    announcement: null
    updates: null
    toggled_on:
    • DeploymentStatus.environment
    • Mutation.createDeploymentStatus
    • CreateDeploymentStatusInput
    • CreateDeploymentStatusPayload
    • Mutation.createDeployment
    • CreateDeploymentInput
    • CreateDeploymentPayload
      owning_teams:
    • '@github/pages'
  • title: >-
    MergeInfoPreview - More detailed information about a pull request's merge
    state.
    description: >-
    This preview adds support for accessing fields that provide more detailed
    information about a pull request's merge state.
    toggled_by: ':merge-info-preview'
    announcement: null
    updates: null
    toggled_on:
    • PullRequest.canBeRebased
    • PullRequest.mergeStateStatus
      owning_teams:
    • '@github/pe-pull-requests'
  • title: UpdateRefsPreview - Update multiple refs in a single operation.
    description: This preview adds support for updating multiple refs in a single operation.
    toggled_by: ':update-refs-preview'
    announcement: null
    updates: null
    toggled_on:
    • Mutation.updateRefs
    • GitRefname
    • RefUpdate
    • UpdateRefsInput
    • UpdateRefsPayload
      owning_teams:
    • '@github/repos'
  • title: Access to a Repository's Dependency Graph
    description: This preview adds support for reading a dependency graph for a repository.
    toggled_by: ':hawkgirl-preview'
    announcement: null
    updates: null
    toggled_on:
    • DependencyGraphManifest
    • Repository.dependencyGraphManifests
    • DependencyGraphManifestEdge
    • DependencyGraphManifestConnection
    • DependencyGraphDependency
    • DependencyGraphDependencyEdge
    • DependencyGraphDependencyConnection
      owning_teams:
    • '@github/dependency-graph'
  • title: Project Event Details
    description: >-
    This preview adds project, project card, and project column details to
    project-related issue events.
    toggled_by: ':starfox-preview'
    announcement: null
    updates: null
    toggled_on:
    • AddedToProjectEvent.project
    • AddedToProjectEvent.projectCard
    • AddedToProjectEvent.projectColumnName
    • ConvertedNoteToIssueEvent.project
    • ConvertedNoteToIssueEvent.projectCard
    • ConvertedNoteToIssueEvent.projectColumnName
    • MovedColumnsInProjectEvent.project
    • MovedColumnsInProjectEvent.projectCard
    • MovedColumnsInProjectEvent.projectColumnName
    • MovedColumnsInProjectEvent.previousProjectColumnName
    • RemovedFromProjectEvent.project
    • RemovedFromProjectEvent.projectColumnName
      owning_teams:
    • '@github/github-projects'
  • title: Labels Preview
    description: >-
    This preview adds support for adding, updating, creating and deleting
    labels.
    toggled_by: ':bane-preview'
    announcement: null
    updates: null
    toggled_on:
    • Mutation.createLabel
    • CreateLabelPayload
    • CreateLabelInput
    • Mutation.deleteLabel
    • DeleteLabelPayload
    • DeleteLabelInput
    • Mutation.updateLabel
    • UpdateLabelPayload
    • UpdateLabelInput
      owning_teams:
    • '@github/pe-pull-requests'
  • title: Import Project
    description: This preview adds support for importing projects.
    toggled_by: ':slothette-preview'
    announcement: null
    updates: null
    toggled_on:
    • Mutation.importProject
      owning_teams:
    • '@github/pe-issues-projects'
  • title: Team Review Assignments Preview
    description: >-
    This preview adds support for updating the settings for team review
    assignment.
    toggled_by: ':stone-crop-preview'
    announcement: null
    updates: null
    toggled_on:
    • Mutation.updateTeamReviewAssignment
    • UpdateTeamReviewAssignmentInput
    • TeamReviewAssignmentAlgorithm
    • Team.reviewRequestDelegationEnabled
    • Team.reviewRequestDelegationAlgorithm
    • Team.reviewRequestDelegationMemberCount
    • Team.reviewRequestDelegationNotifyTeam
      owning_teams:
    • '@github/pe-pull-requests'

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage Do not begin working on this issue until triaged by the team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants