vine icon indicating copy to clipboard operation
vine copied to clipboard

vine.file is not a function

Open mohitxskull opened this issue 1 year ago • 6 comments
trafficstars

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

mohitxskull avatar Jun 29 '24 03:06 mohitxskull

Hey @mohitxskull! 👋🏻

Have you configured the package with node ace configure vinejs?

RomainLanz avatar Jun 29 '24 07:06 RomainLanz

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 😅

mohitxskull avatar Jun 29 '24 10:06 mohitxskull

Heyy @RomainLanz

Please can i get your help here?

mohitxskull avatar Jul 01 '24 15:07 mohitxskull

Could you please create a repository with the minimum amount of code to reproduce your issue?

RomainLanz avatar Jul 02 '24 08:07 RomainLanz

Heyy i was not able to reproduce the error, i think there is problem with packages i have installed

mohitxskull avatar Jul 05 '24 17:07 mohitxskull

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

mohitxskull avatar Jul 20 '24 20:07 mohitxskull

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

thetutlage avatar Nov 30 '24 07:11 thetutlage