-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: auto suggestions for 404s #133
base: main
Are you sure you want to change the base?
Conversation
This PR will trigger a minor release when merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great idea. Any rate limit concerns with the Google API?
const query = getSuggestionQuery(url); | ||
const resp = await fetch(`${SEARCH_ENGINE_BASE_URL}?cx=${searchEngineId}&key=${searchEngineKey}&q=${encodeURIComponent(query)}`); | ||
if (!resp.ok) { | ||
throw new Error(`Google API returned unsuccessful response ${resp.status}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be helpful to have the query included in this error message?
// send alert to the Slack channel - group under a thread if ts value exists | ||
await slackClient.fileUpload({ | ||
thread_ts: slackContext?.thread_ts, | ||
channel_id: slackContext?.channel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If slackContext
is undefined, where will the file be uploaded to?
Unit tests will follow.
For the detailed documentation/explanation about the logic used to find suggestions, please see https://wiki.corp.adobe.com/display/AEMSites/Auto+Generation+of+Redirect+Targets+for+404+Pages