Skip to content

getQuery() empty on Vercel #1020

Closed as duplicate of#1880
Closed as duplicate of#1880
@drewbaker

Description

@drewbaker

Environment

I have a Nuxt install, using the built in Nitro with some custom endpoints located in /server/routes/api. I am using defineCachedEventHandler for them.

Locally, getQuery() returns what you'd expect, but when deployed to Vercel, it's empty.

URL like this:
https://example.vercel.app/api/foo/e9cb0344-3bf3-44f6-8d90-c620a638be48/test?name=drew

Vercel logs the "searchParam" in it's logger, but I can't get getQuery() to return anything. I'm very perplexed.

Reproduction

export default defineCachedEventHandler(async (event) => {
    return getQuery(event)
},
{
    maxAge: 31_536_000 // 1 year
})

Describe the bug

getQuery() is empty on Vercel, but populated on local.

Additional context

Screenshot of the Vercel logs. Notice my console.log is all undefined, but the SearchParams are populated in this case with a test of writers=9).

Image
Image

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions