Skip to content

GitHub integration: okit.rest.issues.createComment is not a function #10691

Description

@spatialy

Bug Description

When commenting inside Huly on issues synced with GitHub, comments are not created on GitHub. The GitHub integration service (github-1 container) logs the following error:

TypeError: okit.rest.issues.createComment is not a function
    at CommentSyncManager.createGithubComment (/usr/src/app/bundle.js:294043:47)

GitHub → Huly sync works fine; only Huly → GitHub comment creation is broken.

Root Cause

In services/github/pod-github/src/sync/comments.ts, the createGithubComment and updateComment methods obtain an Octokit instance via:

const okit = (await this.provider.getOctokit(ctx, chatMessage.modifiedBy)) ?? container.container.octokit

The user-scoped Octokit returned by getOctokit() may not have the .rest plugin properly available. This is the same class of bug that was fixed in #10442 for okit.graphql is not a function, where ensureGraphQLOctokit() was introduced as a guard. However, that fix only covered GraphQL calls and missed the two REST API calls (createComment and updateComment) in the same file.

Environment

  • Self-hosted v0.7.382 on PostgreSQL

Fix

Apply the same safety pattern used in #10442: add an ensureRESTOctokit() function that validates the .rest plugin is available on the Octokit instance, falling back to the installation Octokit when it's not.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions