You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect to find the error both in the console and in Slack, however Slack's call fails:
Access to XMLHttpRequest at 'https://hooks.slack.com/services/xxx/xxx/xxx' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.
Here you can take a look to the request headers as provided by this plugin:
Hmm, that's an interesting issue. All of the issues that I've seen relating to Slack and CORS seem to be specifically in reference to the web API proper, and this package is effectively a light wrapper around Axios that just massages the data a bit before it sends it off. The user agent suggests that you're using this in a browser application (Axios's default user agent appears to be axios/<version>), which might be the culprit; this transport was designed for Node environments and hasn't been tested in browsers to my knowledge.
The replies to this tweet from the Slack API Twitter account indicate that browsers calling the webhooks seems to be a bit of a recurring problem. I'll see if I can find a solution that I can implement on my end, but it might not be something that I can fix.
this transport was designed for Node environments and hasn't been tested in browsers to my knowledge
Yeah after a bit I figured this might be the case. I was approaching Winston and its plugins as a browser logging solution but I've since realized it's mainly for Node environments.
In any case, it would of course be awesome to be able to make this plugin compatible with the browser, so I'll keep an eye on this.
Thanks for taking the time to look into it and reply ❤️
Hello there! I hope you are having a great day.
I've found this issue (described in the title) while trying to work with the plugin locally.
I use the following simple configuration:
And then try to log a simple message:
I would expect to find the error both in the console and in Slack, however Slack's call fails:
Here you can take a look to the request headers as provided by this plugin:
And here the payload being sent:
Do you know how to fix this? Can I help in any way?
The text was updated successfully, but these errors were encountered: