[Bug][GitHub Copilot] GitHub Copilot connector validation fails when using Enterprise Slug without Organization

Đang mở Phù hợp với người mới
#8,991 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github, go
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu từ plugins/gh-copilot/api/connection.go:97 và lần theo lệnh gọi xác thực từ plugins/gh-copilot/api/test_connection.go:39. Tái hiện bài kiểm tra connector với một Enterprise Slug có dấu gạch nối và không có Organization, sau đó xác minh rằng cấu hình hợp lệ chỉ dành cho enterprise sẽ thành công mà không gặp lỗi 400.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Stale type/bug
Search before asking
  • I had searched in the issues and found no similar issues.
What happened
Actual Behavior

When trying to create a GitHub Copilot connector, the connection test always fails even though the Enterprise Slug is provided.

The connection test fails with a 400 error (either enterprise or organization is required) but organization slug is specified into connection wizard

Stack Trace
attached stack trace -- stack trace: | github.com/apache/incubator-devlake/plugins/gh-copilot/api.validateConnection | /app/plugins/gh-copilot/api/connection.go:97 | github.com/apache/incubator-devlake/plugins/gh-copilot/api.TestConnection | /app/plugins/gh-copilot/api/test_connection.go:39 | github.com/apache/incubator-devlake/server/api.registerPluginEndpoints.handlePluginCall.func1 | /app/server/api/router.go:149 | github.com/gin-gonic/gin.(*Context).Next | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 | github.com/apache/incubator-devlake/server/api.CreateApiServer.CSRFProtect.(*Service).CSRFProtect.func3 | /app/server/api/auth/middleware.go:140 | github.com/gin-gonic/gin.(*Context).Next | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 | github.com/apache/incubator-devlake/server/api.CreateApiServer.RequireAuth.(*Service).RequireAuth.func2 | /app/server/api/auth/middleware.go:104 | github.com/gin-gonic/gin.(*Context).Next | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 | github.com/apache/incubator-devlake/server/api.OAuth2ProxyAuthentication.func1 | /app/server/api/middlewares.go:114 | github.com/gin-gonic/gin.(*Context).Next | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 | github.com/apache/incubator-devlake/server/api.CreateApiServer.OIDCAuthentication.(*Service).OIDCAuthentication.func1 | /app/server/api/auth/middleware.go:61 | github.com/gin-gonic/gin.(*Context).Next | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 | github.com/apache/incubator-devlake/server/api.RequirePushAuthentication.func1 | /app/server/api/middlewares.go:157 | github.com/gin-gonic/gin.(*Context).Next | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 | github.com/apache/incubator-devlake/server/api.RestAuthentication.func1 | /app/server/api/middlewares.go:135 | github.com/gin-gonic/gin.(*Context).Next | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 | github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1 | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 | github.com/gin-gonic/gin.(*Context).Next | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 | github.com/gin-gonic/gin.LoggerWithConfig.func1 | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/logger.go:240 | github.com/gin-gonic/gin.(*Context).Next | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 | github.com/gin-gonic/gin.(*Engine).handleHTTPRequest | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620 | github.com/gin-gonic/gin.(*Engine).ServeHTTP | /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 | net/http.serverHandler.ServeHTTP | /usr/local/go/src/net/http/server.go:3311 | net/http.(*conn).serve | /usr/local/go/src/net/http/server.go:2073 | runtime.goexit | /usr/local/go/src/runtime/asm_amd64.s:1771 Wraps: (2) either enterprise or organization is required (400) Error types: (1) *withstack.withStack (2) *errutil.leafError
What do you expect to happen

The connector should successfully validate the connection when a valid Enterprise Slug is provided, even if no Organization is configured.

How to reproduce
  • Open the GitHub Copilot connector configuration page.
  • Enter a valid Enterprise Slug taht contains hyphens
  • Leave the Organization field empty.
  • Generate and provide a Personal Access Token (classic).
  • Test the connection.
Anything else
I also tested the following scenarios:
  • Using a Personal Access Token (classic) with all available permissions.
  • Filling the Organization field with the same value as the Enterprise Slug.
  • Creating new tokens and retrying the connection.

All attempts result in the same error.

Error Message
Plain Texteither enterprise or organization is required (400)

Question / Clarification

Could this issue be related to the format of the Enterprise Slug?

In our case, the Enterprise Slug contains hyphens, for example:

my-company
Version

v1.0.3-beta14@50f664e

Are you willing to submit PR?
  • Yes I am willing to submit a PR!
Code of Conduct
Ngôn ngữ chính
Go
Star
3.1k
Fork
812
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
48

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/devlake

Tất cả issue của apache/devlake

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.