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

Getting 500s using Example Code and Status Page Says API is Operational #451

Open
jb185555 opened this issue Jan 20, 2022 · 2 comments
Open
Labels
type: bug bug in the library

Comments

@jb185555
Copy link

https://status.sendgrid.com/ says it's operational

I'm using the exact example code here:
https://docs.sendgrid.com/api-reference/api-keys/create-api-keys

Why am I getting a server error?

Code Snippet

package main
import (
        "fmt"
        "log"
        "os"
        "github.com/sendgrid/sendgrid-go"
)
func main() {
        apiKey := os.Getenv("SENDGRID_API_KEY")
        host := "https://api.sendgrid.com"
        request := sendgrid.GetRequest(apiKey, "/v3/api_keys", host)
        request.Method = "POST"
        request.Body = []byte(`{
  "name": "My API Key",
  "scopes": [
    "mail.send",
    "alerts.create",
    "alerts.read"
  ]
}`)
        response, err := sendgrid.API(request)
        if err != nil {
                log.Println(err)
        } else {
                fmt.Println(response.StatusCode)
                fmt.Println(response.Body)
                fmt.Println(response.Headers)
        }
}

Exception/Log

{"errors":[{"field":null,"message":"internal server error"}]}

Technical details:

  • sendgrid-go version:
github.com/sendgrid/sendgrid-go v3.10.5+incompatible
  • go version:
$ go version
go version go1.16.5 darwin/amd64
@jb185555
Copy link
Author

I updated my key permissions and the result is different, but a 500 should not have been sent back regardless.

@beebzz
Copy link

beebzz commented Jan 27, 2022

Hi @jb185555, I wasn't able to reproduce the issue locally. Feel free to reach out to SendGrid customer support in order to properly debug this issue.

@beebzz beebzz added type: non-library issue API issue not solvable via the SDK type: bug bug in the library and removed type: non-library issue API issue not solvable via the SDK labels Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

2 participants