Skip to content

Github Enterprise Cloud - New node_id format results in "error running command: illegal base64 data at input byte 2" during release creation #149

@MiliDurasovic

Description

@MiliDurasovic

Describe the bug

We have recently migrated from Github Enterprise to Github Enterprise Cloud and afterwards one of our pipelines, which uses github-release-resource fails during release creation with the following error:

error running command: illegal base64 data at input byte 2

After confirming that all the new URL´s are correct, I dug deeper and noticed that the node_id seems to be now URL-Safe with no = padding and always starts with RE_.
Example: "node_id": "RE_xyzXYZxyzXYZxyzX"

And this seems to be the cause of this error.
Since there was no fallback to DatabaseId for Enterprise, I have tried fixing it locally myself by adding the following fix:

index b00b322..158ff49 100644
--- a/github_graphql.go
+++ b/github_graphql.go
@@ -49,18 +49,22 @@ func (g *GitHubClient) listReleasesV4EnterPrice() ([]*github.RepositoryRelease,
                        publishedAt, _ := time.ParseInLocation(time.RFC3339, r.Node.PublishedAt.Time.Format(time.RFC3339), time.UTC)
                        createdAt, _ := time.ParseInLocation(time.RFC3339, r.Node.CreatedAt.Time.Format(time.RFC3339), time.UTC)
                        var releaseID int64
-                       decodedID, err := base64.StdEncoding.DecodeString(r.Node.ID)
-                       if err != nil {
-                               return nil, err
-                       }
-                       re := regexp.MustCompile(`.*[^\d]`)
-                       decodedID = re.ReplaceAll(decodedID, []byte(""))
-                       if string(decodedID) == "" {
-                               return nil, errors.New("bad release id from graph ql api")
-                       }
-                       releaseID, err = strconv.ParseInt(string(decodedID), 10, 64)
-                       if err != nil {
-                               return nil, err
+                       if r.Node.DatabaseId == 0 {
+                               decodedID, err := base64.StdEncoding.DecodeString(r.Node.ID)
+                               if err != nil {
+                                       return nil, err
+                               }
+                               re := regexp.MustCompile(`.*[^\d]`)
+                               decodedID = re.ReplaceAll(decodedID, []byte(""))
+                               if string(decodedID) == "" {
+                                       return nil, errors.New("bad release id from graph ql api")
+                               }
+                               releaseID, err = strconv.ParseInt(string(decodedID), 10, 64)
+                               if err != nil {
+                                       return nil, err
+                               }
+                       } else {
+                               releaseID = int64(r.Node.DatabaseId)
                        }

                        allReleases = append(allReleases, &github.RepositoryRelease{
diff --git a/model.go b/model.go
index 216f0b2..c65f4c1 100644
--- a/model.go
+++ b/model.go
@@ -22,6 +22,7 @@ type ReleaseObjectEnterprise struct {
        CreatedAt    githubv4.DateTime `graphql:"createdAt"`
        PublishedAt  githubv4.DateTime `graphql:"publishedAt"`
        ID           string            `graphql:"id"`
+       DatabaseId   githubv4.Int      `graphql:"databaseId"`
        IsDraft      bool              `graphql:"isDraft"`
        IsPrerelease bool              `graphql:"isPrerelease"`
        Name         string            `graphql:"name"`

Created a local image and the tests were passing.
Afterwards the release creation was working fine again. But this solution kind of feel like a bandaid on a broken leg, since the underlying issue with the new node_id format is still there.

You guys probably have a better idea on how to handle this without breaking downward compatibility.

Strangely I see no mention of such a change in the release notes and the official API docs still show the old node_id format:
https://docs.github.com/en/enterprise-cloud@latest/rest/releases/releases?apiVersion=2026-03-10#create-a-release

Important parts from the pipeline:

  - name: "github-release"
    type: custom-github-release
    source:
      owner: FooBar
      repository: MyRepo
      github_v4_api_url: https://api.REDACTED.ghe.com/graphql
      github_api_url: https://api.REDACTED.ghe.com/
      github_uploads_url: https://uploads.REDACTED.ghe.com/
      access_token: ((git_access_token))
      release: false
      pre_release: true
...
jobs:
  - name: "create-new-dev-release"
    plan:
...
      - put: github-release
        params:
          name: foobar/name
          tag: foobar/tag
          commitish: foobar/sha
          globs:
            - foobar/asset
          generate_release_notes: true
        no_get: true

Thanks in advance!

Reproduction steps

1.Try and create a release with github-release-resource (<=v1.13.2) to a repository on latest Github Enterprise Cloud
2.
3.
...

Expected behavior

Release has been created

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions