diff --git a/packages/spacecat-shared-google-client/CHANGELOG.md b/packages/spacecat-shared-google-client/CHANGELOG.md index cc55f4c9d..672e9cf4b 100644 --- a/packages/spacecat-shared-google-client/CHANGELOG.md +++ b/packages/spacecat-shared-google-client/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@adobe/spacecat-shared-google-client-v1.1.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-google-client-v1.1.1...@adobe/spacecat-shared-google-client-v1.1.2) (2024-05-27) + + +### Bug Fixes + +* site url verification ([#242](https://github.com/adobe/spacecat-shared/issues/242)) ([fb1ead7](https://github.com/adobe/spacecat-shared/commit/fb1ead70157de9273f322a59fbe61d99bbc8e70f)) + # [@adobe/spacecat-shared-google-client-v1.1.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-google-client-v1.1.0...@adobe/spacecat-shared-google-client-v1.1.1) (2024-05-25) diff --git a/packages/spacecat-shared-google-client/package.json b/packages/spacecat-shared-google-client/package.json index 9f1bcf647..31fb7aa5e 100644 --- a/packages/spacecat-shared-google-client/package.json +++ b/packages/spacecat-shared-google-client/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/spacecat-shared-google-client", - "version": "1.1.1", + "version": "1.1.2", "description": "Shared modules of the Spacecat Services - Google Client", "type": "module", "main": "src/index.js", diff --git a/packages/spacecat-shared-google-client/src/index.js b/packages/spacecat-shared-google-client/src/index.js index 8720e1ad0..337cef7b8 100644 --- a/packages/spacecat-shared-google-client/src/index.js +++ b/packages/spacecat-shared-google-client/src/index.js @@ -67,10 +67,6 @@ export default class GoogleClient { throw new Error('Missing refresh token in secret'); } - if (!isValidUrl(config.siteUrl)) { - throw new Error('Invalid site URL in secret'); - } - authClient.setCredentials({ access_token: config.accessToken, refresh_token: config.refreshToken, @@ -93,6 +89,9 @@ export default class GoogleClient { } async getOrganicSearchData(startDate, endDate, dimensions = ['date'], rowLimit = 1000, startRow = 0) { + if (!isValidUrl(this.siteUrl)) { + throw new Error('Error retrieving organic search data from Google API: Invalid site URL in secret'); + } if (!isValidDate(startDate) || !isValidDate(endDate)) { throw new Error('Error retrieving organic search data from Google API: Invalid date format'); } diff --git a/packages/spacecat-shared-google-client/test/index.test.js b/packages/spacecat-shared-google-client/test/index.test.js index 0f624f7a1..11f73d58d 100644 --- a/packages/spacecat-shared-google-client/test/index.test.js +++ b/packages/spacecat-shared-google-client/test/index.test.js @@ -261,6 +261,16 @@ describe('GoogleClient', () => { expect(error.message).to.equal('Error retrieving organic search data from Google API: Start row must be greater than or equal to 0'); } }); + + it('should throw an error if site URL is invalid', async () => { + stubSecretManager({ ...defaultConfig, site_url: 'not a valid url' }); + try { + const googleClient = await GoogleClient.createFrom(context, baseURL); + await googleClient.getOrganicSearchData(startDate, endDate); + } catch (error) { + expect(error.message).to.equal('Error retrieving organic search data from Google API: Invalid site URL in secret'); + } + }); }); describe('listSites', () => { diff --git a/packages/spacecat-shared-rum-api-client/CHANGELOG.md b/packages/spacecat-shared-rum-api-client/CHANGELOG.md index fdf511d70..9231e2ff6 100644 --- a/packages/spacecat-shared-rum-api-client/CHANGELOG.md +++ b/packages/spacecat-shared-rum-api-client/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@adobe/spacecat-shared-rum-api-client-v1.8.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v1.8.2...@adobe/spacecat-shared-rum-api-client-v1.8.3) (2024-05-25) + + +### Bug Fixes + +* **deps:** update external fixes ([#241](https://github.com/adobe/spacecat-shared/issues/241)) ([85babb2](https://github.com/adobe/spacecat-shared/commit/85babb22b8663f79fe857dead6ecc3bf65674687)) + # [@adobe/spacecat-shared-rum-api-client-v1.8.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v1.8.1...@adobe/spacecat-shared-rum-api-client-v1.8.2) (2024-05-11) diff --git a/packages/spacecat-shared-rum-api-client/package.json b/packages/spacecat-shared-rum-api-client/package.json index 5bc3848c0..3d3b37140 100644 --- a/packages/spacecat-shared-rum-api-client/package.json +++ b/packages/spacecat-shared-rum-api-client/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/spacecat-shared-rum-api-client", - "version": "1.8.2", + "version": "1.8.3", "description": "Shared modules of the Spacecat Services - Rum API client", "type": "module", "main": "src/index.js", diff --git a/packages/spacecat-shared-utils/CHANGELOG.md b/packages/spacecat-shared-utils/CHANGELOG.md index bbdef5fc6..a699e32a1 100644 --- a/packages/spacecat-shared-utils/CHANGELOG.md +++ b/packages/spacecat-shared-utils/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@adobe/spacecat-shared-utils-v1.15.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.15.2...@adobe/spacecat-shared-utils-v1.15.3) (2024-05-25) + + +### Bug Fixes + +* **deps:** update external fixes ([#241](https://github.com/adobe/spacecat-shared/issues/241)) ([85babb2](https://github.com/adobe/spacecat-shared/commit/85babb22b8663f79fe857dead6ecc3bf65674687)) + # [@adobe/spacecat-shared-utils-v1.15.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.15.1...@adobe/spacecat-shared-utils-v1.15.2) (2024-05-18) diff --git a/packages/spacecat-shared-utils/package.json b/packages/spacecat-shared-utils/package.json index 2f1a316cf..0f96ed159 100644 --- a/packages/spacecat-shared-utils/package.json +++ b/packages/spacecat-shared-utils/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/spacecat-shared-utils", - "version": "1.15.2", + "version": "1.15.3", "description": "Shared modules of the Spacecat Services - utils", "type": "module", "main": "src/index.js",