You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the lovingly-crafted world of JavaScript, null is of type object.
So my null front matter fields satisfy the first if statement. 😎
However in the very next step, we try to access the __astro field on this null object - resulting in explosions. 😢
Seems like a possible fix would be to also check curr !== null.
Is this still happening to anyone else? I’m running into this error on a project. The linked repo above also generates an error despite this issue being closed. Will post more details shortly.
The code that was causing this error does not exist at all anymore since many versions ago. If you're encountering something similar in a current version, it is most definitely not this issue and we'd love if you could open a new issue!
The code that was causing this error does not exist at all anymore since many versions ago. If you're encountering something similar in a current version, it is most definitely not this issue and we'd love if you could open a new issue!
Thank you! Will do a little more investigation to make sure it’s not something I’m doing wrong, will open another issue if it seems appropriate.
What version of
astro
are you using?2.1.2
Are you using an SSR adapter? If so, which one?
No
What package manager are you using?
npm
What operating system are you using?
MacOS 12.2
Describe the Bug
I have some blog posts written in Markdown with YAML front matter, e.g:
I've also set up my Astro schemas to allow null values in my front matter.
However! Since Astro
2.1.0
, if ANY of these fields are nullish (such as theauthor
field above) ,astro build
will crash with the following error:The problem appears to be in
content/utils.ts
.In the
extractFrontmatterAssets()
function there is this block of code:In the lovingly-crafted world of JavaScript,
null
is of typeobject
.So my
null
front matter fields satisfy the firstif
statement. 😎However in the very next step, we try to access the
__astro
field on thisnull
object - resulting in explosions. 😢Seems like a possible fix would be to also check
curr !== null
.Link to Minimal Reproducible Example
https://github.com/NJKode/astro-build-error
Participation
The text was updated successfully, but these errors were encountered: