Skip to content

Conversation

@adriandlam
Copy link

@adriandlam adriandlam commented Nov 15, 2025

Changes

  • Fixed unhandled rejection bug in vite-plugin-astro-server where undefined rejections caused TypeError
  • Added null/undefined checks to all error type checking methods (AstroError.is(), CompilerError.is(), etc.)
  • Prevents Cannot read property 'type' of undefined errors when handleUnhandledRejection receives undefined rejection values

Before: Error type checking methods would crash when passed null or undefined
After: Error type checking methods safely return false for null or undefined values

Testing

No new tests added. The fix is a defensive null check that prevents TypeErrors when error type checking methods receive null or undefined values.

Docs

No docs changes needed. This is an internal bug fix that doesn't affect user-facing APIs or behavior.

@changeset-bot
Copy link

changeset-bot bot commented Nov 15, 2025

🦋 Changeset detected

Latest commit: 7b047d7

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Nov 15, 2025
@github-actions

This comment was marked as spam.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 15, 2025

CodSpeed Performance Report

Merging #14769 will not alter performance

Comparing adriandlam:main (7b047d7) with main (78ed8b5)1

Summary

✅ 6 untouched

Footnotes

  1. No successful run was found on main (e878679) during the generation of this report, so 78ed8b5 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Thanks @adriandlam!

@ematipico
Copy link
Member

@adriandlam can you at least tell us in which case you could encounter this issue? It isn't clear from the description. Also, we would appreciate if we could have a test that is able to reproduce the issue

@adriandlam
Copy link
Author

adriandlam commented Nov 20, 2025

@adriandlam can you at least tell us in which case you could encounter this issue? It isn't clear from the description. Also, we would appreciate if we could have a test that is able to reproduce the issue

Yeah for sure @ematipico. Workflow DevKit throws an undefined unhandled rejection. In other frameworks it seems that this is just silently ignored. In Astro, unhandled rejections are caught and processed which access properties like "type" (which doesn't exist on undefined).

Also yes, I'll add a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants