ad-on-is/adonis-autoswagger

No such file or directory

Closed this issue · 4 comments

I am using this pacakge with Adonis 6.2.1
It works well locally but after deploying it to the production its not generating the files as its still trying to access the controllers with ts extension. However after the build process the path build/app/controllers only contains .js files.

{"message":"ENOENT: no such file or directory, open '/var/www/myapp/build/config/../app/controllers/auth_controller.ts'","name":"Error","status":500,"frames":[]}

The steps I have followed are

node ace docs:generate
node ace build --production
cp swagger.yml build/

any feedback would be appreciated. Thanks.

Autoswagger requires NODE_ENV to be set to "production" to load the generated yaml file.

I have the same error but in different context.
I'm not on production but error occured for changing default location of controllers from app/controllers to app/http/controllers

here is my error

ENOENT: no such file or directory, open 'file:///data/data/com.termux/files/home/js/adonis/boilerplate/config/swagger.ts/../app/controllers/v1/dashboard_controller.ts'

It seems like AutoSwagger find controllers statically. It would be better if it look on adonisrc.ts for paths

export default defineConfig({
  directories: {
    commands: 'app/commands',
    providers: 'app/providers',
    httpControllers: 'app/http/controllers',
    middleware: 'app/http/middleware',
    validators: 'app/validation/validators',
  },
//...
})

I have the same error but in different context. I'm not on production but error occured for changing default location of controllers from app/controllers to app/http/controllers

here is my error

ENOENT: no such file or directory, open 'file:///data/data/com.termux/files/home/js/adonis/boilerplate/config/swagger.ts/../app/controllers/v1/dashboard_controller.ts'

It seems like AutoSwagger find controllers statically. It would be better if it look on adonisrc.ts for paths

export default defineConfig({
  directories: {
    commands: 'app/commands',
    providers: 'app/providers',
    httpControllers: 'app/http/controllers',
    middleware: 'app/http/middleware',
    validators: 'app/validation/validators',
  },
//...
})

I think your issue might be related to this one: #56

Done in version 3.0