#astro sync failed: bad indentation of a mapping entry

1 messages · Page 1 of 1 (latest)

ruby shoal
#

I'm trying to build an optimized og image for a blog, and I got this error when I updated the shape of the markdown fronmatter hero.src to include an @ -

❯ pnpm astro sync
 error   `astro sync` command failed to generate content collection types: bad indentation of a mapping entry
  Hint:
    Check your `src/content/config.*` file for typos.
  File:
    /Users/calebjasik/Git/defined.net/www/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/astro/dist/core/sync/index.js:77:11
  Code:
    76 |     }
    > 77 |     throw new AstroError(
         |           ^
      78 |       {
      79 |         ...AstroErrorData.GenerateContentTypesError,
      80 |         message: AstroErrorData.GenerateContentTypesError.message(safeError.message)
  Stacktrace:
GenerateContentTypesError: `astro sync` command failed to generate content collection types: bad indentation of a mapping entry
    at syncInternal (file:///Users/calebjasik/Git/defined.net/www/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/astro/dist/core/sync/index.js:77:11)
    at async sync (file:///Users/calebjasik/Git/defined.net/www/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/astro/dist/core/sync/index.js:29:10)
    at async sync (file:///Users/calebjasik/Git/defined.net/www/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/astro/dist/cli/sync/index.js:17:20)
    at async runCommand (file:///Users/calebjasik/Git/defined.net/www/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/astro/dist/cli/index.js:138:24)
    at async cli (file:///Users/calebjasik/Git/defined.net/www/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/astro/dist/cli/index.js:148:5)

ex:

hero:
  src: "@assets/images/blog/radio-dishes.jpg"
  alt: A collection of radio dishes for long-range radio communications
dim oxide
#

bad indentation of a mapping entry is a YAML parsing error

#

so I assume you have a frontmatter with a wrong format

#

(because YAML is a bad format!)

ruby shoal
#

YAML is bad

#

it was that i hadn't wrapped all of the src strings in quotes

#

to make sure they were strings

#

struggling again tho:

#
 error   Cannot find package '@assets/images' imported from /Users/calebjasik/Git/defined.net/www/dist/chunks/pages/_...page_.astro.7ee8e2b2.mjs
  File:
    async file:///Users/calebjasik/Git/defined.net/www/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/astro/dist/runtime/server/render/astro/render.js:70:11
#

got

{
  "extends": "astro/tsconfigs/strictest",
  "compilerOptions": {
    "target": "es2020",
    "module": "esnext",
    "jsx": "react-jsx",
    "moduleResolution": "node",
    "noEmit": true,
    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true,
    "verbatimModuleSyntax": true,
    "baseUrl": ".",
    "strict": true,
    "noImplicitOverride": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "paths": {
      "@assets/*": ["src/assets/*"],
      "@atoms/*": ["src/components/atoms/*"],
      "@components/*": ["src/components/*"],
      "@data/*": ["src/data/*"],
      "@layouts/*": ["src/layouts/*"],
      "@screens/*": ["src/components/screens/*"],
      "@scripts/*": ["src/scripts/*"],
      "@styles/*": ["src/styles/*"],
      "@util/*": ["src/util/*"]
    }
  },
  "exclude": ["functions/**/*"]
}

#

but for some reason it's not resolving nested folders of my alias???

#

though a direct import works fine

dim oxide
#

that I do not know, aliases are also terrifying

ruby shoal
#

deff seems like the only way for me to throw an import for an image into frontmatter though...

#

maybe i need to make both sides **?

#

nope

#

"@assets/**": ["src/assets/**"], fixed nada

dusky jewel
#

"@assets/*": ["src/assets/*"] should work

#

I have it this way on my personal blog.

ruby shoal
#

yeah.. specifically i'm putting these in my frontmatter, then doing an async import of the image file so that I can run it through @astrojs/image's getImage() to optimize our og images

#

seems like that must be the issue? shrug

dusky jewel
#

my frontmatter does not have indentation tho.

#
---
title: 'What are Abstract Syntax Trees?'
description: 'A brief introduction to Abstract Syntax Trees (ASTs).'
pubDate: 2023-03-08
draft: true
cover: '@assets/posts/cat-in-server-room.png'
coverAlt: 'cat in a server room'
---
dim oxide
#

i feel like astro:assets probably makes this quite easier than @astrojs/image

ruby shoal
#

probably!

#

not there yet though, a blocker was the inclusion of the Picture component, so thx for working on that 💜

grim shale
#

Hi everyone ! I think my error familiar with you
``` error astro sync command failed to generate content collection types: unexpected end of the stream within a double quoted scalar
Hint:
Check your src/content/config.* file for typos.
Error reference:
https://docs.astro.build/en/reference/errors/generate-content-types-error/
File:
/vercel/path0/node_modules/astro/dist/core/sync/index.js:76:11
Code:
75 | }
> 76 | throw new AstroError(
| ^
77 | {
78 | ...AstroErrorData.GenerateContentTypesError,
79 | message: AstroErrorData.GenerateContentTypesError.message(safeError.message)
Stacktrace:
GenerateContentTypesError: astro sync command failed to generate content collection types: unexpected end of the stream within a double quoted scalar
at syncInternal (file:///vercel/path0/node_modules/astro/dist/core/sync/index.js:76:11)
at async AstroBuilder.setup (file:///vercel/path0/node_modules/astro/dist/core/build/index.js:93:21)
at async AstroBuilder.run (file:///vercel/path0/node_modules/astro/dist/core/build/index.js:163:23)
at async build (file:///vercel/path0/node_modules/astro/dist/core/build/index.js:44:3)
at async build (file:///vercel/path0/node_modules/astro/dist/cli/build/index.js:21:3)
at async runCommand (file:///vercel/path0/node_modules/astro/dist/cli/index.js:116:7)
at async cli (file:///vercel/path0/node_modules/astro/dist/cli/index.js:144:5)
Error: Command "npm run build" exited with 1

#

Any idea ? @dim oxide @ruby shoal @dusky jewel

#
  "$schema": "https://frontmatter.codes/frontmatter.schema.json",
  "frontMatter.taxonomy.contentTypes": [
    {
      "name": "default",
      "pageBundle": false,
      "previewPath": "blog/",
      "filePrefix": null,
      "fileType": "mdx",
      "fields": [
        {
          "title": "Title",
          "name": "title",
          "type": "string"
        },
        {
          "title": "Cover",
          "name": "image",
          "type": "image",
          "isPreviewImage": true
        },
        {
          "title": "Intro",
          "name": "intro",
          "type": "string"
        },
        {
          "title": "Author (use the one from src/content/author)",
          "name": "author",
          "type": "string"
        },
        {
          "title": "Publishing date",
          "name": "pubDate",
          "type": "datetime",
          "default": "{{now}}",
          "isPublishDate": true,
          "dateFormat": "yyyy-MM-dd"
        },
        {
          "title": "Tag",
          "name": "tag",
          "type": "string"
        }
      ]
    },
```+