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

Content-Type should be application/json #1017

Open
ZeeCoder opened this issue Nov 13, 2020 · 1 comment
Open

Content-Type should be application/json #1017

ZeeCoder opened this issue Nov 13, 2020 · 1 comment
Labels
status: help wanted requesting help from the community type: bug bug in the library

Comments

@ZeeCoder
Copy link

Using an API key with a newline at the end will make SendGrid respond with the error "Content-Type should be application/json".

Since this repo is for the PHP SDK specifically, it might not be the best place for it, but since I've used this package I thought I post the issue here.

This is strictly speaking a user-error, but I think SendGrid should give a better error, saying that the it is the API key that's wrong.

Maybe it could just trim whitespaces?
I'm no security expert, so not sure about that.

For more background, this happened to me because I was saving the key as base64 encoded string in an env var for later use (using k8s secrets), and the command I used was:

echo 'myapikey' | base64

☝️ What I missed here is that "echo" will add a newline at the end by default, so the correct way to do this is:

echo -n 'myapikey' | base64

Even if this is not fixed I hope that I help someone in the future googling, because it took me a while to finally find this by accident:
http://jlsegurosystem.com.br/vendor/sendgrid/sendgrid/TROUBLESHOOTING.md

@thinkingserious thinkingserious added status: help wanted requesting help from the community type: bug bug in the library labels Nov 14, 2020
@thinkingserious
Copy link
Contributor

Thank you for reporting this @ZeeCoder!

This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.

With best regards,

Elmer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

2 participants