Skip to content

fix: check whether AMO attached the source after a gateway error - #3912

Open
itsnjstyle27 wants to merge 1 commit into
mozilla:masterfrom
itsnjstyle27:fix/check-source-after-gateway-error
Open

itsnjstyle27 wants to merge 1 commit into
mozilla:masterfrom
itsnjstyle27:fix/check-source-after-gateway-error

Conversation

@itsnjstyle27

Copy link
Copy Markdown

Relates to #3807

When AMO answers the source upload with a 502, 503 or 504, web-ext sign fails right away. Sometimes AMO finishes the upload anyway, after the proxy in front of it has already given up, which is what the report in #3807 describes.

In #3808 I tried treating those responses as a success, and @rpl explained why that's wrong: web-ext can't assume the upload went through. This PR takes a different approach. Instead of assuming either way, web-ext now asks AMO.

After a 502, 503 or 504 on the source upload, web-ext polls the version details for up to a minute. It's the same endpoint waitForApproval already uses. It checks the source field, which AMO only fills in once a source file is attached to the version.

  • If the source shows up, web-ext logs a warning and carries on.
  • If it doesn't, or the check itself fails, it throws the same "Uploading source failed" error as before.

Nothing changes for other errors. A 500, a 4xx, or a gateway error on a patch that isn't a source upload all fail exactly as they do now.

Tests: I added unit tests for these cases:

  • the source is attached (502, 503 and 504)
  • the source shows up on the second check
  • the source never shows up
  • the version check itself fails
  • a 500 response
  • a patch without a source

The four tests where the upload should continue fail without this change. ESLint and the full unit suite pass. One file watcher test failed once when I ran everything together on Windows, but it passes on its own both with and without this change.

If you'd still rather keep web-ext strict here, that's fine and I'm happy to close this.

When the source upload gets a 502, 503 or 504, poll the version details
for up to a minute and only continue if AMO reports a source for the
version. Otherwise fail with the same error as before.
@itsnjstyle27
itsnjstyle27 marked this pull request as ready for review October 23, 2026 10:32
@itsnjstyle27

Copy link
Copy Markdown
Author

Hi maintainers! Just checking in on this PR whenever you get a chance. I’d appreciate your feedback and am happy to make any changes needed. Thanks for your time!

@Rob--W

Rob--W commented Oct 26, 2026

Copy link
Copy Markdown
Member

Thanks for your PR. The team has reduced review capacity right now, and is unable to provide consistent reviews for the next two weeks.

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.

2 participants