{"action":"created","issue":{"url":"https://api.github.com/repos/mcollina/avvio/issues/30","repository_url":"https://api.github.com/repos/mcollina/avvio","labels_url":"https://api.github.com/repos/mcollina/avvio/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/mcollina/avvio/issues/30/comments","events_url":"https://api.github.com/repos/mcollina/avvio/issues/30/events","html_url":"https://github.com/mcollina/avvio/issues/30","id":265491286,"number":30,"title":"Use inside use doesn't work anymore","user":{"login":"allevo","id":1054125,"avatar_url":"https://avatars1.githubusercontent.com/u/1054125?v=4","gravatar_id":"","url":"https://api.github.com/users/allevo","html_url":"https://github.com/allevo","followers_url":"https://api.github.com/users/allevo/followers","following_url":"https://api.github.com/users/allevo/following{/other_user}","gists_url":"https://api.github.com/users/allevo/gists{/gist_id}","starred_url":"https://api.github.com/users/allevo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allevo/subscriptions","organizations_url":"https://api.github.com/users/allevo/orgs","repos_url":"https://api.github.com/users/allevo/repos","events_url":"https://api.github.com/users/allevo/events{/privacy}","received_events_url":"https://api.github.com/users/allevo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-10-14T13:29:07Z","updated_at":"2017-10-15T20:21:50Z","closed_at":null,"author_association":"NONE","body":"Using fastify, this code works correctly in `0.28` (`avvio` version 2):\r\n\r\n```js\r\nfunction pluginOk (fastify, opts, next) { next() }\r\n\r\nt.test('ok', t => {\r\n  t.plan(2)\r\n  const fastify = Fastify()\r\n\r\n  fastify.register(require('./index'), err => {\r\n    t.error(err)\r\n    fastify.register(pluginOk, err => {\r\n      t.error(err)\r\n    })\r\n  })\r\n})\r\n```\r\n\r\nIn `0.30.2` (`avvio` version 3) the second error has this message: `Impossible to load \"pluginOk\" plugin because the parent \"\" was already loaded`\r\n\r\nThis behaviour is introduced by https://github.com/mcollina/avvio/pull/29 on avvio version 3.\r\n\r\nHow can I rewrite the previous code in new avvio version?"},"comment":{"url":"https://api.github.com/repos/mcollina/avvio/issues/comments/336738655","html_url":"https://github.com/mcollina/avvio/issues/30#issuecomment-336738655","issue_url":"https://api.github.com/repos/mcollina/avvio/issues/30","id":336738655,"user":{"login":"wooliet","id":1421908,"avatar_url":"https://avatars3.githubusercontent.com/u/1421908?v=4","gravatar_id":"","url":"https://api.github.com/users/wooliet","html_url":"https://github.com/wooliet","followers_url":"https://api.github.com/users/wooliet/followers","following_url":"https://api.github.com/users/wooliet/following{/other_user}","gists_url":"https://api.github.com/users/wooliet/gists{/gist_id}","starred_url":"https://api.github.com/users/wooliet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wooliet/subscriptions","organizations_url":"https://api.github.com/users/wooliet/orgs","repos_url":"https://api.github.com/users/wooliet/repos","events_url":"https://api.github.com/users/wooliet/events{/privacy}","received_events_url":"https://api.github.com/users/wooliet/received_events","type":"User","site_admin":false},"created_at":"2017-10-15T20:21:50Z","updated_at":"2017-10-15T20:21:50Z","author_association":"NONE","body":"@mcollina I'm sorry to bother you guys with this, and I'll be glad to move this to the fastify repo if you prefer. But I think there's a communication breakdown somewhere. \r\n\r\nCopied below is code that is representative of what _used_ to work (fastify _0.29.2_) but now (_0.30.2_) results in:\r\n\r\n> Error: Impossible to load \"bound _after\" plugin because the parent \"formBodyPlugin\" was already loaded\r\n\r\nI am interested in what an updated version should look like.\r\n\r\n```javascript\r\n\r\nconst async = require('async');\r\nconst formbody = require('fastify-formbody');\r\nconst fastify = require('fastify')();\r\n\r\nasync.waterfall([\r\n  next => plugins(next),\r\n  next => routes(next)\r\n], (err) => {\r\n  if(err) process.exit(1);\r\n  fastify.listen('9090', '0.0.0.0', err => console.log('running'));\r\n})\r\n\r\n\r\nfunction plugins(done) {\r\n  fastify.register(formbody, {}, (err) => {\r\n    done(err);\r\n  });\r\n}\r\n\r\nfunction routes(done) {\r\n  fastify.get('/ping', (req, resp) => {\r\n    resp.code(204).send();\r\n  });\r\n  done();\r\n}\r\n```\r\n\r\n\r\n"}}
{"actor":{"display_login":"wooliet"}}