Getting a 405 error in my action when using axios post

Hello, post requests where I am trying to take the user’s email as a query param are returning a 405, even though the endpoint works. Please advise.

const axios = require("axios");

/**
 * @param {Event} event - Details about registration event.
 */
exports.onExecutePostUserRegistration = async (event) => {
  await axios.post("https://myapi.com/collector", { params: { email: event.user.email }});
};

Hey there @rahlok welcome back!

I’m unable to reproduce the 405 using your same code just set to an different endpoint - Are you positive https://myapi.com/collector allows POST? If I configure my test API to not allow for POST I do see The specified method is not allowed against this resource.

Keep us posted!

2 Likes

Hi there, thanks for testing. The endpoint does accept post as I am able to post via Postman. But it did occur to me that it could be a CORS issue, but the error code wouldn’t make sense, right?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.