Skip to content

[NEXT-1204] opengraph-image can't be used to accept params in catch-all routes (Error: Catch-all must be the last part of the URL.) #49630

@timfee

Description

@timfee

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000
    Binaries:
      Node: 20.1.0
      npm: 9.6.4
      Yarn: N/A
      pnpm: 8.5.0
    Relevant packages:
      next: 13.4.1
      eslint-config-next: 13.4.1
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true), Metadata (metadata, generateMetadata, next/head, head.js), Middleware / Edge (API routes, runtime)

Link to the code that reproduces this issue

#48162

To Reproduce

I am trying to use opengraph-image.tsx inside of ./app/[[...path]] but get the Error: Catch-all must be the last part of the URL. message.

I saw a similar issue that was recently closed: #48162 - however I am trying to use the params to construct the image:

export default async function og({ params }: { params: { path: string[] } }) {
  console.log("Generating for", params)
  return new ImageResponse(...)
}

I wasn't sure based on the discussion in the related issue if this was WAI or slated for a future fix, so wanted to surface it in my case, where I needed to accept params. Thanks!

Describe the Bug

Cannot use opengraph-image inside of a [[...catchAll]] route; error is: Error: Catch-all must be the last part of the URL.

Expected Behavior

This functionality is allowed

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-1204

Metadata

Metadata

Assignees

Labels

MetadataRelated to Next.js' Metadata API.RuntimeRelated to Node.js or Edge Runtime with Next.js.bugIssue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.locked

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions