-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Sorry if this is not the right place to post this, but I don't know what else this error might refer to, I already tried asking the fastify community on Discord.
I get this error when registering the plugin @fastify/cors :
node_modules\fastify\lib\route.js:306
throw new FST_ERR_DUPLICATED_ROUTE(opts.method, opts.url)
^
FastifyError [Error]: Method 'OPTIONS' already declared for route '*'
at Object.addNewRoute (...\node_modules\fastify\lib\route.js:306:19)
at Object.route (...\node_modules\fastify\lib\route.js:217:19)
at Object.prepareRoute (...\node_modules\fastify\lib\route.js:150:18)
at Object._options [as options] (...\node_modules\fastify\fastify.js:264:34)
at fastifyCors (...\node_modules\@fastify\cors\index.js:42:11)
at Plugin.exec (...\node_modules\avvio\plugin.js:130:19)
at Boot.loadPlugin (...node_modules\avvio\plugin.js:272:10)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'FST_ERR_DUPLICATED_ROUTE',
statusCode: 500
}The problem is that I didn't register the route '*' so I don't know how to fix that.
Edit:
I found these pieces of code in your adapter, I think they are causing the error (?)
Line 60 in 482d3a3
| fastify.all('/*', function (request) { |
Line 53 in 482d3a3
| fastify.all('/*', async function (request, reply) { |
Metadata
Metadata
Assignees
Labels
No labels