{"record":{"id":"12dba57f8f80de82","repo":"medusajs/medusa","slug":"verification-provider-is-required","errorCode":null,"errorMessage":"Verification provider is required","messagePattern":"Verification provider is required","errorType":"exception","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/modules/auth/src/services/auth-module.ts","lineNumber":691,"sourceCode":"      data,\n      sharedContext\n    )\n\n    if (!valid) {\n      throw new MedusaError(\n        MedusaError.Types.NOT_ALLOWED,\n        \"Recovery code is invalid or already used\"\n      )\n    }\n  }\n\n  @InjectManager()\n  async requestAuthVerification(\n    data: AuthTypes.RequestAuthVerificationDTO,\n    @MedusaContext() sharedContext: Context = {}\n  ): Promise<AuthTypes.RequestAuthVerificationResponse> {\n    if (!data.code_provider) {\n      throw new MedusaError(\n        MedusaError.Types.INVALID_DATA,\n        \"Verification provider is required\"\n      )\n    }\n\n    return await this.authVerificationProviderService_.request(\n      data.code_provider,\n      data,\n      sharedContext\n    )\n  }\n\n  @InjectManager()\n  async confirmAuthVerification(\n    data: AuthTypes.ConfirmAuthVerificationDTO,\n    @MedusaContext() sharedContext: Context = {}\n  ): Promise<AuthTypes.ConfirmAuthVerificationResponse> {\n    const codeProvider = data.code_provider ?? \"token\"","sourceCodeStart":673,"sourceCodeEnd":709,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/modules/auth/src/services/auth-module.ts#L673-L709","documentation":"Thrown by requestAuthVerification when the DTO lacks code_provider, which selects the verification provider (e.g. email, sms) responsible for sending the code. It is an INVALID_DATA error raised before any provider call.","triggerScenarios":"Calling authModuleService.requestAuthVerification({ identifier: 'a@b.c' }) without code_provider; passing code_provider: undefined or empty string due to a misbuilt request body.","commonSituations":"API route not forwarding the code_provider field from req.body/validatedBody; frontend form missing the provider select; zod/schema validation not marking the field required.","solutions":["Include a valid code_provider (e.g. 'email') in the request DTO","Make code_provider required in your route's validation schema so it fails early with a clear message","Check for typos in the field name (code_provider, not provider)"],"exampleFix":"// before\nawait authModule.requestAuthVerification({ identifier: email })\n// after\nawait authModule.requestAuthVerification({ identifier: email, code_provider: 'email' })","handlingStrategy":"validation","validationCode":"if (!data.code_provider) throw new Error('code_provider is required')\nawait authModule.requestAuthVerification(data)","typeGuard":"const hasCodeProvider = (d: RequestAuthVerificationDTO): boolean => Boolean(d.code_provider)","tryCatchPattern":"null","preventionTips":["Make code_provider required in route validation schemas","Test verification routes with missing-field payloads"],"tags":["auth","validation","verification"],"backgroundTag":"missing-required-field","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}