Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore regexes in fetchDirConfig #2362

Merged
merged 1 commit into from Oct 9, 2023

Conversation

gierschv
Copy link
Contributor

@gierschv gierschv commented Oct 3, 2023

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Since #2213 (?), our build generates a lot of the following error. After digging in the nuxt content code, it seems that one of our queryContent call is generating a regex in $where, which leads to that crash.

 ERROR  [nuxt] [request error] [unhandled] [500] input.endsWith is not a function                                                                                        3:49:03β€―PM
  at withTrailingSlash (./node_modules/.pnpm/ufo@1.3.1/node_modules/ufo/dist/index.mjs:327:18)
  at joinURL (./node_modules/.pnpm/ufo@1.3.1/node_modules/ufo/dist/index.mjs:389:13)
  at ./.nuxt/prerender/chunks/nitro/nitro-prerenderer.mjs:17008:60
  at Array.find (<anonymous>)
  at fetchDirConfig (./.nuxt/prerender/chunks/nitro/nitro-prerenderer.mjs:17008:30)
  at ./.nuxt/prerender/chunks/nitro/nitro-prerenderer.mjs:17041:63
  at Array.reduce (<anonymous>)
  at ./.nuxt/prerender/chunks/nitro/nitro-prerenderer.mjs:17041:39
  at async ./.nuxt/prerender/chunks/nitro/nitro-prerenderer.mjs:17343:21
  at async Object.handler (./node_modules/.pnpm/h3@1.8.2/node_modules/h3/dist/index.mjs:1630:19)
const page = await queryContent('en')
  .where({
    pid: 'general'
  })
 .findOne();

Which generates:

{
  where: [ { pid: 'general' }, { _path: /^\/en/ } ],
  first: true,
  sort: [ { _file: 1, '$numeric': true } ],
  dirConfig: true 
}

I'm not sure if I need to add a regression somewhere, I didn't find any related tests and it's first time digging in this codebase :)

Thanks!

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link
Member

@farnabaz farnabaz left a comment

Choose a reason for hiding this comment

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

Thanks

@farnabaz farnabaz merged commit 9ec555e into nuxt:main Oct 9, 2023
2 checks passed
@gierschv gierschv deleted the fix/pipeline-regex-path branch October 9, 2023 12:45
@farnabaz farnabaz mentioned this pull request Oct 26, 2023
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.

None yet

2 participants