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 missing await of params when metadata with an image file pt2 #74193

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

gadcam
Copy link
Contributor

@gadcam gadcam commented Dec 20, 2024

Fixing a bug

Continuation of #71871 but for another code path.
The function is already marked async

Code that was generated before

                          openGraph: [
                            async (props) => [
                              {
                                url:
                                  (0,
                                  __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2f$dist$2f$lib$2f$metadata$2f$get$2d$metadata$2d$route$2e$js__$5b$app$2d$rsc$5d$__$28$ecmascript$29$__[
                                    'fillMetadataSegment'
                                  ])(
                                    '//[locale]/page-name',
                                    props.params,
                                    'opengraph-image.jpg'
                                  ) +
                                  `?${__TURBOPACK__imported__module__$5b$project$5d2f$app$2f5b$locale$5d2f$page$2d$name$2f$opengraph$2d$image$2e$jpg$2e$mjs__$7b$__IMAGE__$3d3e$__$225b$project$5d2f$app$2f5b$locale$5d2f$page$2d$name$2f$opengraph$2d$image$2e$jpg__$5b$app$2d$rsc$5d$__$28$static$2922$__$7d$__$5b$app$2d$rsc$5d$__$28$structured__image__object$2c$__ecmascript$2c$__Next$2e$js__server__component$29$__['default'].src.split('/').splice(-1)[0]}`,
								  ...

Stacktrace

Error: Route "/[locale]/page-name" used `params.locale`. `params` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis
    at createParamsAccessError ($REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\dist\src\server\request\params.ts:467:10)
    at logDedupedError ($REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\dist\src\server\create-deduped-by-callsite-server-error-logger.ts:46:21)
    at syncIODev ($REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\dist\src\server\request\params.ts:445:5)
    at Object.get ($REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\dist\src\server\request\params.ts:403:11)
    at interpolateDynamicPath ($REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\src\server\server-utils.ts:74:25)
    at fillMetadataSegment ($REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\src\lib\metadata\get-metadata-route.ts:65:39)
    at tree.children.children.metadata.openGraph ($REPOROOT\.next\server\chunks\ssr\node_modules_next_46559b._.js:78:249)
    at $REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\dist\src\lib\metadata\resolve-metadata.ts:383:28
    at Array.map (<anonymous>)
    at collectStaticImagesFiles ($REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\dist\src\lib\metadata\resolve-metadata.ts:381:59)
    at resolveStaticMetadata ($REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\dist\src\lib\metadata\resolve-metadata.ts:401:5)
    at collectMetadata ($REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\dist\src\lib\metadata\resolve-metadata.ts:451:37)
    at process.processTicksAndRejections ($REPOROOT\lib\internal\process\task_queues.js:95:5)
    at async resolveMetadataItemsImpl ($REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\dist\src\lib\metadata\resolve-metadata.ts:550:3)
    at async resolveMetadataItemsImpl ($REPOROOT\.next\server\chunks\ssr\file:\$REPOROOT\node_modules\next\dist\src\lib\metadata\resolve-metadata.ts:564:5)
    at async resolveMetadataItemsImpl ($REPOROOT\.next\server\chunks\ssr\node_modules_next_dist_c3ca74._.js:8080:9)

@ijjk ijjk added the Turbopack Related to Turbopack with Next.js. label Dec 20, 2024
@ijjk
Copy link
Member

ijjk commented Dec 20, 2024

Allow CI Workflow Run

  • approve CI run for commit: 231cc77

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

1 similar comment
@ijjk
Copy link
Member

ijjk commented Dec 20, 2024

Allow CI Workflow Run

  • approve CI run for commit: 231cc77

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants