hmrc / vat-api

Apache License 2.0
67 stars 17 forks source link

Sandbox: Submission 500 response when using organisation test user on Create test user service #873

Closed charles-f closed 2 years ago

charles-f commented 3 years ago

Bug report

You must read the information below before you submit a bug report.

The MTD API team cannot help if your bug report is about:

For any of the above, you must contact the Software Developer Support Team directly at SDSTeam@hmrc.gov.uk. The SDS Team do not monitor this repository.

This repository is for bug reports relating to VAT API code in this repository only.

Fill in the sections below to submit your bug report:

Describe the bug A clear and concise description of what the bug is.

I am creating an organisation test user here - https://developer.service.hmrc.gov.uk/api-test-user - then authorising/granting access, then exchanging the authcode for the access tokens - which I then use to get the obligations (which works) but when trying to submit I get a 500 response error.

Note this doesn't happen when you select individual test users on above link.

These requests that I'm doing here are all done in Postman to remove my product from the equation (of what could be going wrong).

Note that in my automated tests, I still generate test users with my applications server token, which is not the same way as this link is generating test users - and by creating the test user data via this method (organisation) - then the submission still works.

This is something that has only just started happening - so I think it's a change on HMRC side (as I'm using postman to run these tests so it is not my product at all).

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen.

Screenshots / Requests / Responses If applicable, add screenshots to help explain your problem. image

Additional context Add any other context about the problem here.

It works when I create the test user for organisation through authorising the request with the applications server token image

But when creating an organisation through https://developer.service.hmrc.gov.uk/api-test-user then the submission doesn't work and returns 500 internal server error

hmrc-api-team commented 3 years ago

Hi @charles-f,

We are currently investigating an issue in the test environment which is causing VAT return submissions to fail with a 500 response for certain users. We will keep you updated here as we try to determine the cause and start working towards a solution. Apologies for the disruption.

Kind regards, MTD API Team

charles-f commented 3 years ago

Hi @hmrc-api-team,

Do you have any update on the investigation of this please?

Kind regards, @charles-f

dhanajik commented 3 years ago

@hmrc-api-team,

I am also facing the same issue. My code was absolutely tested on the test environment previously but since a couple of days getting below error while submitting returns

500 Internal Server Error: [{"code":"INTERNAL_SERVER_ERROR","message":"An internal server error occurred"}]

Please have a look into this on priority.

Thank you

hmrc-api-team commented 3 years ago

@charles-f , @dhanajik,

This is already being investigated with priority. As far as we can tell, the problem seems to be with one of the services which the VAT API interfaces with as part of authorisation. The team responsible for that service have been notified, and are working on trying to find a resolution. We have, however, identified that the issue only seems to be occurring for users which are enrolled for both "mtd-income-tax", and "mtd-vat". While obviously not ideal, we believe that if you were to amend your software to create a user with only "mtd-vat" enrolment that it should work. We do not, however, intend this to be a permanent solution and are working towards restoring the previous functionality.

Kind regards, MTD API Team

charles-f commented 3 years ago

@hmrc-api-team

Thanks for the update, I already create my postman test users with only "mtd-vat" (see image) image image

Note that I authenticate my postman API requests with my applications server token. Probably unrelated based on your comment about "mtd-income-tax" services.

However, many in my company use your website to generate these test credentials - https://developer.service.hmrc.gov.uk/api-test-user - as they do not have access or know-how to use postman.

Note however - this issue only happens if you select organisation in your test user list - not individuals (as reported in bug above). Individuals presumably have this "mtd-income-tax" sent in the request to create. while organisations presumably do not(?).

You cannot select if you only want "mtd-vat" from your website.

Kind regards, Charles

hmrc-api-team commented 2 years ago

Hi all, we have been informed that a fix has now been put in place. New Organisations that are generated should have the relevant user information, so the fact that Organisation users through the frontend are also generated with "mtd-income-tax" shouldn't be a problem anymore.

Since the fix was put into place for new Organisations, please regenerate an Organisation user for yourself to get a working user through the frontend.

If after creating a new Organisation user you are still experiencing this problem please comment back on this Issue and we can raise it with the relevant team.

Kind regards