Enonic version: 7.11.0
OS: Win11
I started a new project with next.xp using nextjs-enonic-template v0.9.0
and webpack .-starter
with com.enonic.lib:lib-guillotine:6.0.5
/ com.enonic.lib:lib-nextjs:0.10.0
.
I have a controller graphql.js
based on the expample given in the docs here
I configured API in site.xml and can access it with localhost:8080/site/default/[draft/master]/lyn/graphql
I get the following error in my frontend:
Client-side error when trying to fetch data (path = "${site}/") Error: {"code":404,"message":"Data fetching failed (message: '{\"status\":404,\"message\":\"Page [/lyn/graphql] not found\"}')"}
at fetchFromApi (webpack-internal:///./src/_enonicAdapter/guillotine/fetchContent.ts:39:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async fetchGuillotine (webpack-internal:///./src/_enonicAdapter/guillotine/fetchContent.ts:70:20)
at async doRecursiveFetch (webpack-internal:///./src/pages/[[...contentPath]].tsx:98:20)
at async getStaticPaths (webpack-internal:///./src/pages/[[...contentPath]].tsx:82:19)
at async Object.buildStaticPaths (D:\Developement\enonic\nextjs-lyn\node_modules\next\dist\build\utils.js:597:33)
error - Error: Invalid `paths` value returned from getStaticPaths in /[[...contentPath]].
`paths` must be an array of strings or objects of shape { params: [key: string]: string }
at Object.buildStaticPaths (D:\Developement\enonic\nextjs-lyn\node_modules\next\dist\build\utils.js:618:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'Error',
page: '/[[...contentPath]]'
}
I see that /lyn/graphql
is submitted as path! But I do not understand - why.
I also saw that in the demo-backend, GraphQL is also set up as a controller- but not included in site.xml
Is this now part of the lib-nextjs
?