Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing Custom Code to Verifications Fails #210

Open
dylanreich opened this issue Sep 6, 2023 · 0 comments
Open

Passing Custom Code to Verifications Fails #210

dylanreich opened this issue Sep 6, 2023 · 0 comments

Comments

@dylanreich
Copy link

dylanreich commented Sep 6, 2023

Issue Summary

invalid memory address or nil pointer dereference when passing a custom code.

Steps to Reproduce

Pass a value to setCustomCode. If this line is commented, verifications are created just fine and the SMS is received.

Code Snippet

client := twilio.NewRestClientWithParams(twilio.ClientParams{
		Username: accountSid,
		Password: authToken,
	})

	params := &verify.CreateVerificationParams{}
	params.SetCustomCode("867530")
	params.SetTo(t_int.Phone)
	params.SetChannel("sms")

	resp, err := client.VerifyV2.CreateVerification(verificationSid, params)
	if err != nil {
		fmt.Println(err.Error())

		return c.Status(http.StatusBadRequest).JSON(fiber.Map{
			"status": resp.Status,
			"err":    err.Error(),
		})
	} else {
		return c.Status(http.StatusOK).JSON(fiber.Map{
			"status": resp.Status,
		})
	}

Exception/Log

Invalid parameter: Code (null) More info: https://www.twilio.com/docs/errors/60200
runtime error: invalid memory address or nil pointer dereference

Technical details:

  • twilio-go version: github.com/twilio/twilio-go v1.12.0
  • go version: 1.21.0 darwin/arm64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant