Skip to content

Conversation

@0618
Copy link
Contributor

@0618 0618 commented Mar 8, 2023

Original PR #3516 had to be reverted #3523 because it report statasCode 308 from internal links as errors (build).

It was because if the returned status is 0, it would keep using 308.

Why didn't the issue happen in PoC?
Because the PoC fork filtered the 308 by isInternalRedirection, but this main repo had a different SITE_URL , which might be the dev site, so it was likely testing the links on the dev site.

Description of changes

Issue #, if available

Description of how you validated changes

Tested in PoC draft PR #3524:

(node:2877) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(Use node --trace-warnings ... to show where the warning was created)
(node:2877) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(node:2877) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGTERM listeners added to [process]. Use emitter.setMaxListeners() to increase limit
(node:2877) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGHUP listeners added to [process]. Use emitter.setMaxListeners() to increase limit

Checklist

  • PR description included
  • yarn test passes
  • Tests are updated
  • No side effects or sideEffects field updated
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@changeset-bot
Copy link

changeset-bot bot commented Mar 8, 2023

⚠️ No Changeset found

Latest commit: 94530f7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -1,3 +1,3 @@
export const PROMISE_POOL_CONCURRENCY = 10;
export const PROMISE_POOL_CONCURRENCY = 5;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the memory leak.

Since the Github Action Step didn't change after reducing the PROMISE_POOL_CONCURRENCY to 5, we don't have to test numbers bigger than 5 to reduce the testing time.

statusCode,
})
)?.statusCode || statusCode;
)?.statusCode ?? statusCode;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the major change of this new PR 👿

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain what this change does?

Copy link
Contributor Author

@0618 0618 Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Good question.

If a link is good, we return a statusCode: 0 (code). The problems was, the redirected link got a 0, and it was 308 before redirected, so 0 || 308 and we got 308.

We should have been able to filter out the 308 errors when reporting result (code), but since the SITE_URL Github Env Variable was not set to be localhost:3000 (Github Env Variable generates the sitemap, meaning the link checker was not testing against 'localhost:3000'), it was not filtered out.

That's why we got those internal 308 errors which failed the build.

Since we've changed the Github Env Variable, the problem should be resolved.

So, it's actually not necessary to change || to ?? for internal 308 redirection.

However, since we have another logic to test 301 from docs.amplify.aws (code), this change is still useful because we don't have a filter when reporting result.

@0618 0618 temporarily deployed to ci March 9, 2023 00:02 — with GitHub Actions Inactive
@0618 0618 temporarily deployed to ci March 9, 2023 00:02 — with GitHub Actions Inactive
@0618 0618 temporarily deployed to ci March 9, 2023 00:02 — with GitHub Actions Inactive
@0618 0618 temporarily deployed to ci March 9, 2023 00:02 — with GitHub Actions Inactive
@0618 0618 marked this pull request as ready for review March 9, 2023 16:30
@0618 0618 requested a review from a team as a code owner March 9, 2023 16:30

</Alert>

For your [configured social providers](https://docs.amplify.aws/lib/auth/social_signin_web_ui/q/platform/flutter/), you can configure Apple, Amazon, Facebook, or Google:
Copy link
Contributor Author

@0618 0618 Mar 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wasn't this caught by Cypress Link Checker?

Because 301 status code is acceptable in Cypress Link Checker, but we add a new logic to not accept 301 if it's from docs.amplify.aws #3517

TODO: a follow-up PR is made to move 301 statusCode from the defaultGoodStatusCode list #3535

wlee221
wlee221 previously approved these changes Mar 9, 2023
Copy link
Contributor

@wlee221 wlee221 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@0618 0618 enabled auto-merge (squash) March 10, 2023 18:17
@0618 0618 temporarily deployed to ci March 10, 2023 18:18 — with GitHub Actions Inactive
@0618 0618 temporarily deployed to ci March 10, 2023 18:19 — with GitHub Actions Inactive
@0618 0618 temporarily deployed to ci March 10, 2023 18:19 — with GitHub Actions Inactive
@0618 0618 temporarily deployed to ci March 10, 2023 18:19 — with GitHub Actions Inactive
@0618 0618 merged commit 9f0b937 into main Mar 10, 2023
@0618 0618 deleted the refactor-link-checker-pupperteer-gh branch March 10, 2023 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants