content icon indicating copy to clipboard operation
content copied to clipboard

Azure Static Web Apps and Nuxt Content

Open owljacob opened this issue 1 year ago • 0 comments

Environment


  • Operating System: Linux
  • Node Version: v20.9.0
  • Nuxt Version: 3.9.3
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: [email protected]
  • Builder: -
  • User Config: app (theme color), experimental (deep -> false), modules, colorMode, ui
  • Runtime Modules: @nuxtjs/[email protected], normalizedModule(THIS IS TRANSFORMER), @nuxt/[email protected], @nuxt/[email protected]
  • Build Modules: -

Reproduction

Let me know if it needs reproduction.

Describe the bug

I query content directly in [...slug] and have a custom transformer written. I use the following query to do this:

const route = useRoute();
const { data, error } = await useAsyncData("article-detail", () => queryContent(route.path).only(["description", "body"]).findOne());

It works fine when I use navigateTo(_path) from the article list (index.vue) but this is what I receive when I try to load the article directly. Surprisingly, when I use the API directly (as below), it returns everything correctly.

Error: [GET] "/api/_content/query/4CktpAQDgT.1705965443072.json?_params=%7B%22only%22:%5B%22description%22,%22body%22%5D,%22first%22:true,%22where%22:%5B%7B%22_path%22:%22/en/article/240123%22%7D%5D,%22sort%22:%5B%7B%22_file%22:1,%22$numeric%22:true%7D%5D%7D": <no response> Response is not defined

/api/_content/query/4CktpAQDgT.1705965443072.json?_params={"only":["description","body"],"first":true,"where":[{"_path":"/en/article/240123"}],"sort":[{"_file":1,"$numeric":true}]}

Although I think there is a better way to achieve the same thing, I think it should work.

Additional context

No response

Logs

No response

owljacob avatar Jan 22 '24 23:01 owljacob