Closed haupt-pascal closed 4 months ago
Its still an issue, why does this even closed?
Hi, GitHub closes the issues when I push a commit that relates to the issue. You'll need to wait for the release before you can use it though. I'll ping this issue once it's out :)
Details
Cheers!
To be honest, I am not really sure if this is an error or maybe a misconfiguration at my side.
I am trying to use unlighthouse in comination with a dockerized AdonisJS 6 instance. Can someone help me? I've tried to create the same functionality in NuxtJS and getting the same error.
I am getting the following error:
adonis_app | [15:34:39.022] ERROR (1070): Cannot read properties of undefined (reading 'mockRouter') adonis_app | request_id: "npv35w2mmh3f9phg194ajzxs" adonis_app | x-request-id: "npv35w2mmh3f9phg194ajzxs" adonis_app | err: { adonis_app | "type": "TypeError", adonis_app | "message": "Cannot read properties of undefined (reading 'mockRouter')", adonis_app | "stack": adonis_app | TypeError: Cannot read properties of undefined (reading 'mockRouter') adonis_app | at normaliseRoute (file:///home/node/app/node_modules/@unlighthouse/core/dist/index.mjs:431:42) adonis_app | at file:///home/node/app/node_modules/@unlighthouse/core/dist/index.mjs:5458:28 adonis_app | at Array.map ()
adonis_app | at resolveReportableRoutes (file:///home/node/app/node_modules/@unlighthouse/core/dist/index.mjs:5458:15)
adonis_app | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
adonis_app | at async ctx.start (file:///home/node/app/node_modules/@unlighthouse/core/dist/index.mjs:6043:18)
adonis_app | at UnlighthousesController.analyze (/home/node/app/app/controllers/unlighthouses_controller.ts:15:5)
adonis_app | at ShieldMiddleware.handle (/home/node/app/node_modules/@adonisjs/shield/src/shield_middleware.ts:64:5)
adonis_app | at SessionMiddleware.handle (/home/node/app/node_modules/@adonisjs/session/src/session_middleware.ts:81:22)
adonis_app | at (/home/node/app/node_modules/@adonisjs/static/src/static_middleware.ts:74:11)
adonis_app | "status": 500
adonis_app | }
And this is the code I am using unlighthouses_controller.ts:
import type { HttpContext } from '@adonisjs/core/http' import { createUnlighthouse } from 'unlighthouse' import { createServer } from '@unlighthouse/server'
export default class UnlighthousesController { async analyze({ request }: HttpContext) { const unlighthouse = await createUnlighthouse({ site: request.input('url'), cache: false, }) console.log(unlighthouse) const { server, app } = await createServer() await unlighthouse.setServerContext({ url: server.url, server: server.server, app })
} }
unlighthouse.config.ts:
export default { puppeteerOptions: { args: ['--no-sandbox', '--disable-setuid-sandbox'], }, }