vine
vine copied to clipboard
vine.file is not a function
Package version
2.1.0
Describe the bug
This is the error i am getting when i run node ace. The development server is working fine and there are no problem even when i build the application.
TypeError: vine.file is not a function
at anonymous app/validators/index.ts:56
51| .transform((value) => new Secret(value))
52|
53| // ==================== User
54|
55| export const EmailSchema = vine.string().email({
❯ 56| host_whitelist: ['gmail.com'],
57| })
58|
59| export const PasswordSchema = vine
60| .string()
61| .minLength(6)
This is my code on line 102
export const ImageFileSchema = vine.file({ size: '5mb', extnames: ['png', 'jpg', 'avif', 'webp'] })
According to docs i can use it like this and in vscode function dropdown the file function is showing
Reproduction repo
No response
Hey @mohitxskull! 👋🏻
Have you configured the package with node ace configure vinejs?
Heyy @RomainLanz
i don't remember doing so because i didn't setup the project today but i checked the steps which are performed when we do that and vinejs was there when i checked provider list
providers: [
() => import('@adonisjs/core/providers/app_provider'),
() => import('@adonisjs/core/providers/hash_provider'),
{
file: () => import('@adonisjs/core/providers/repl_provider'),
environment: ['repl', 'test'],
},
() => import('@adonisjs/core/providers/vinejs_provider'),
() => import('@adonisjs/cors/cors_provider'),
() => import('@adonisjs/lucid/database_provider'),
() => import('@adonisjs/auth/auth_provider'),
() => import('@adonisjs/bouncer/bouncer_provider'),
() => import('@adonisjs/mail/mail_provider'),
() => import('@adonisjs/limiter/limiter_provider'),
() => import('@adonisjs/core/providers/edge_provider'),
],
And i saw this in docs just now so it looks like the problem is on my side 😅
Heyy @RomainLanz
Please can i get your help here?
Could you please create a repository with the minimum amount of code to reproduce your issue?
Heyy i was not able to reproduce the error, i think there is problem with packages i have installed
Heyy @RomainLanz
i was able to reproduce it
https://github.com/mohitxskull/vine-file
when you will do yarn and after that run node ace, you will see the error
then comment the ImageFileSchema line in the /app/validators/base.ts
after that if you run node ace you won't see error
this error coming because i am using EmailSchema in a custom command ( /commands/playground.ts ) which also includes the schema which is using vine.file
in my project i created a seprate file for schemas related to vine.file and avoided using them in custom command files
Hey, its been a while that this issue was reported. I hope the issue was solved for you, if not, please re-open this issue and I will look into it on priority