Repository: amp-labs/connectors
Pull request #1824 (2025-06-28 06:17:21)

fix: update base URLs of Atlassian connector
This PR makes 2 updates:
- Removes version numbers. As a general rule of thumb, base URLs should never contain version numbers. This allows customers who are making proxy calls to use any version of the API they would like to use.
- Update the URL of the base module's base URL to match that of the Jira module (which is the default module.) This is because `api.atlassian.com` is a pretty unusable base URL for proxy request since the builder won't know the cloud ID. I've also double checked our logs and nobody is using Atlassian proxy actions yet, so this isn't going to break any customers.


Patch:
diff --git a/providers/atlassian.go b/providers/atlassian.go
index 38710e28..6a3e05da 100644
--- a/providers/atlassian.go
+++ b/providers/atlassian.go
@@ -17,7 +17,7 @@ func init() {
 	SetInfo(Atlassian, ProviderInfo{
 		DisplayName: "Atlassian",
 		AuthType:    Oauth2,
-		BaseURL:     "https://api.atlassian.com",
+		BaseURL:     "https://api.atlassian.com/ex/jira/{{.cloudId}}/rest/api",
 		Oauth2Opts: &Oauth2Opts{
 			GrantType:                 AuthorizationCode,
 			AuthURL:                   "https://auth.atlassian.com/authorize",
@@ -29,7 +29,7 @@ func init() {
 		DefaultModule:      ModuleAtlassianJira,
 		Modules: &Modules{
 			ModuleAtlassianJira: {
-				BaseURL:     "https://api.atlassian.com/ex/jira/{{.cloudId}}/rest/api/3",
+				BaseURL:     "https://api.atlassian.com/ex/jira/{{.cloudId}}/rest/api",
 				DisplayName: "Atlassian Jira",
 				Support: Support{
 					Read:      true,
@@ -38,7 +38,7 @@ func init() {
 				},
 			},
 			ModuleAtlassianJiraConnect: {
-				BaseURL:     "https://{{.workspace}}.atlassian.net/rest/api/3",
+				BaseURL:     "https://{{.workspace}}.atlassian.net/rest/api",
 				DisplayName: "Atlassian Connect",
 				Support: Support{
 					Read:      true,


Test patch:
diff --git a/providers/utils_test.go b/providers/utils_test.go
index ff414295..d114616e 100644
--- a/providers/utils_test.go
+++ b/providers/utils_test.go
@@ -233,22 +233,6 @@ func TestReadModuleInfo(t *testing.T) { // nolint:funlen,maintidx
 			},
 		},
 		// Root for providers that have multiple modules.
-		{
-			name: "Atlassian root module",
-			input: inType{
-				provider: Atlassian,
-				moduleID: common.ModuleRoot,
-			},
-			expected: &ModuleInfo{
-				BaseURL:     "https://api.atlassian.com",
-				DisplayName: "Atlassian",
-				Support: Support{
-					Proxy: true,
-					Read:  true,
-					Write: true,
-				},
-			},
-		},
 		{
 			name: "Hubspot root module",
 			input: inType{
@@ -342,14 +326,13 @@ func TestReadModuleInfo(t *testing.T) { // nolint:funlen,maintidx
 				moduleID: "random-module-name",
 			},
 			expected: &ModuleInfo{
-				BaseURL:     "https://api.atlassian.com/ex/jira/{{.cloudId}}/rest/api/3",
+				BaseURL:     "https://api.atlassian.com/ex/jira/{{.cloudId}}/rest/api",
 				DisplayName: "Atlassian Jira",
 				Support: Support{
 					Read:  true,
 					Write: true,
 				},
 			},
-			// expectedErr: common.ErrMissingModule,
 		},
 		{
 			name: "Hubspot unknown module",
@@ -365,7 +348,6 @@ func TestReadModuleInfo(t *testing.T) { // nolint:funlen,maintidx
 					Write: true,
 				},
 			},
-			// expectedErr: common.ErrMissingModule,
 		},
 		{
 			name: "Marketo unknown module",
@@ -390,7 +372,6 @@ func TestReadModuleInfo(t *testing.T) { // nolint:funlen,maintidx
 					Write:     true,
 				},
 			},
-			// expectedErr: common.ErrMissingModule,
 		},
 		// Choosing non-root module for providers supporting several modules.
 		{
@@ -400,7 +381,7 @@ func TestReadModuleInfo(t *testing.T) { // nolint:funlen,maintidx
 				moduleID: ModuleAtlassianJira,
 			},
 			expected: &ModuleInfo{
-				BaseURL:     "https://api.atlassian.com/ex/jira/{{.cloudId}}/rest/api/3",
+				BaseURL:     "https://api.atlassian.com/ex/jira/{{.cloudId}}/rest/api",
 				DisplayName: "Atlassian Jira",
 				Support: Support{
 					Read:  true,
@@ -415,7 +396,7 @@ func TestReadModuleInfo(t *testing.T) { // nolint:funlen,maintidx
 				moduleID: ModuleAtlassianJiraConnect,
 			},
 			expected: &ModuleInfo{
-				BaseURL:     "https://{{.workspace}}.atlassian.net/rest/api/3",
+				BaseURL:     "https://{{.workspace}}.atlassian.net/rest/api",
 				DisplayName: "Atlassian Connect",
 				Support: Support{
 					Read:  true,
diff --git a/test/utils/testutils/checks.go b/test/utils/testutils/checks.go
index e1d1eef0..f32d4f35 100644
--- a/test/utils/testutils/checks.go
+++ b/test/utils/testutils/checks.go
@@ -13,7 +13,7 @@ func CheckOutput(t *testing.T, name string,
 	t.Helper()
 
 	if !reflect.DeepEqual(actual, expected) {
-		t.Fatalf("%s: expected: (%v), got: (%v)", name, expected, actual)
+		t.Fatalf("%s: expected: (%v),\n got: (%v)", name, expected, actual)
 	}
 }