Bitbucket Data Center - Rest API for import fails with "null for uri" 404 error

Manoj.S.J April 25, 2021

Issue:

Using the below command as per the documentation to import or migrate a repository to bitbucket: [Data Center and Server 7.12 version]

https://confluence.atlassian.com/bitbucketserver/importing-957497836.html

curl -s -n -u "XXXX:XXXXX" -X POST -H 'Content-type: application/json' -d '{"archivePath":"2021-04-25_15-20-656_mydevopsproject1_nodejs_export.tar"}' http://localhost:7990/rest/api/1.0/migration/import

 

Checks:

  • The username and Password used is correct and has admin privilege
  • Commands are run with elevated or admin access

 

Steps Followed:

  • Created a local setup for the data center as per the below documentation https://hub.docker.com/r/atlassian/bitbucket-server
  • Copied over the repository to the import folder using the docker cp source_path container:destination_path
  • Tried running the curl command mentioned in the document to begin the import process but it fails with the "null for URI" 404 error. The only difference noticed is that the URL used is modified because the latter path "imports" structure was non-existent.

http://localhost:7990/rest/api/1.0/migration/import 

http://localhost:7990/rest/api/1.0/migration/imports

 

Bitbucket_404_Error.png

1 answer

0 votes
Christian Glockner
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 25, 2021

Hi,

What error did you get when using /imports (with an s)?

Cheers,

Christian

Premier Support Engineer

Atlassian

Manoj.S.J April 26, 2021

Hi @Christian Glockner ,

The URL is not accessible and seems like a non-existing path. I believe this is because the docker container does not have a "imports" folder. But can confirm that latest docker image was pulled during the execution. PFB the response when accessed via client browser for both scenarios.

Please let me know if any further details needed.

Cheers,

Manoj

Bitbucket_404_Error_Import_1.PNGBitbucket_404_Error_Import_2.PNG

Bitbucket_URL_Not_Accessible_Imports.png

Christian Glockner
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 26, 2021

Hi,

The correct URL is /imports - the error you're getting in the browser (and HTTP 405 error) means that the URL does not support the GET method (which a browser uses to retrieve the URL). This does not mean that the URL doesn't work or is invalid.

Cheers,

Christian

Premier Support Engineer

Atlassian

Manoj.S.J April 26, 2021

Hi @Christian Glockner,

Got it, checked the API definition, and have updated it accordingly. However, getting the below error even if the archive is present in the shared/data/migration/import.

Could you please let me know if there are any issues in the followed steps:

  • Copied over the repository to the import folder using the docker cp source_path container:destination_path
  • Tried running the below command in the same path
  • curl -s -n -u "usr:pwd" -X POST -H 'Content-type: application/json' -d '{"archivePath":"2021-04-25_15-20-656_mydevopsproject1_nodejs_export.tar"}' http://localhost:7990/rest/api/1.0/migration/imports

Bitbucket_Import_Invalid_Error.png

Thanks,

Manoj

Manoj.S.J April 26, 2021

Hi @Christian Glockner,

Could you please review the above case where the correct URL and params were used and still getting an error?

Thanks,

Manoj

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events