I’m running a test in cypress, where I register an user and it needs to find the email in mailisk and then press the activation link. Here is the code responsible for the link finding:
cy.mailiskSearchInbox(Cypress.env(“MyInbox”), {
to_addr_prefix: testEmailAddress,
subject_includes: “Aktivierung”,
}).then((response) => {
const emails = response.data;
const email = emails[0];
const resetLink = email.text.match(/https://testapp.nameofmytestapp.com/de/confirm-registration/[A-Za-z0-9]+/)[0];
expect(resetLink).to.not.be.undefined;
});
I installed npm, cypress and mailisk in my project folder, I wrote import mailisk in e2e.js file in support folder, I wrote ”
env: {
MAILISK_API_KEY: “MYAPI”,
MAILISK_NAMESPACE: “MYNAMESPACE”,
},
“
in the config.js, and i even added an env file in the root directory, named it cypress.env.json and the content is
”
{
"API_KEY": "MYAPI",
"NAMESPACE": "MYNAMESPACE"
}
”
I ran the
curl –request GET
–url https://api.mailisk.com/api/test
–header ‘Accept: application/json’
–header ‘X-Api-Key: {Api Key}’
command, by opening the folder directory, typing cmd so it opens cmd in the folder, and got success response.
So now the error:
Insufficient permission to perform that task.
node_modules/cypress-mailisk/src/request.js:53:1
51 | throw new Error(‘Authentication failed, check your API key.’);
52 | case 403:
53 | throw new Error(‘Insufficient permission to perform that task.’);
| ^
54 | case 404:
55 | throw new Error(‘Not found, check input parameters.’);
56 | default:
this error occurs when I run the test, it occurs at the moment where the test is supposed to take the email from mailisk. I really need help, I don’t know what can I do to fix it.
I tried changing both api and namespace, idk if that has anything to do with that
I tried it in another folder where I installed npm mailisk and cypress from fresh, nothing changed
I tried researching it in the internet, couldn’t find anything
I even tried asking chat gpt again, no success.
Jan Przybylak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.