Import command is not working

I use the a dev environment to develop project and a production one to migrate to after finishing.

This has been working great for us till recently. I think Octopus.2019.3.1 +
Later whenever we try to import a project we’re getting this error: NRE

Detected automation environment: “NoneOrUnknown”
Space name unspecified, process will run in the default space context
Handshaking with Octopus Server: https://deploy.omni-ts.com/api
Handshake successful. Octopus version: 2019.3.3; API version: 3.0.0
Authenticated as: Bishnu Pokharel bpokharel@rivacrmintegration.com
Finding importer ‘project’
Validating the import
Export file successfully loaded
Checking that lifecycle Default Lifecycle exists
Lifecycle Default Lifecycle does not exist, default lifecycle will be used instead
Found lifecycle ‘Aws-RivaCloud-LifeCycle’
Checking that all environments exist
Checking that all machines exist
Checking that all NuGet Feeds exist
Checking that all Action Templates exist
Checking that all Library Variable Sets exist
Checking that the Project Group exist
Checking that all channel lifecycles exist
Checking that all worker pools exist
No validation errors found. Project is ready to import.
Beginning the import
Beginning import of project ‘Gateway Service’
Importing Project
Project does not exist, a new project will be created
Octopus Server returned an error: Object reference not set to an instance of an object.
Server exception:
Object reference not set to an instance of an object.
System.NullReferenceException
at Octopus.Server.Web.Mapping.DeploymentActionPackageNameMapper.<>c__DisplayClass8_0.b__0(DeploymentProcess p)
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at Octopus.Server.Web.Mapping.DeploymentActionPackageNameMapper.GetProcess(String projectId)
at Octopus.Server.Web.Mapping.DeploymentActionPackageNameMapper.MapToIds(String projectId, IEnumerable1 deploymentActionPackageResources) at Octopus.Server.Web.Mapping.DeploymentActionPackageNameMapper.MapToIds(String projectId, DeploymentActionPackageResource deploymentActionPackageResource) at Octopus.Server.Web.Api.Rules.VersioningStrategyWillBeUpdatedRule.AfterMapBeforeStore(Project model, ProjectResource resource, ISpecialRuleContext context) at Octopus.Server.Web.Infrastructure.Api.Responder1.ExecuteRegisteredRules[TRule](Action2 ruleCallback) at Octopus.Server.Web.Infrastructure.Api.CreateResponseDescriptor2.Responder.ExecuteRegistered()
at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at Octopus.Server.Web.Infrastructure.OctopusNancyModule.<>c__DisplayClass14_0.<get_Routes>b__1(Object x)
at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)

Error from Octopus Server (HTTP 500 InternalServerError)
Exit code: -7

1 Like

Hi there @Khaled_Desouky,

Thanks for reaching out to us today, we’re sorry your export / import isn’t working as expected.

Are you in a position to share your source database backup with us? This would save us a lot of time, if you can - please contact me via support@octopus.com and I’ll send you a link to a secure file sharing location.

Some additional questions to help us troubleshoot your issue, are you performing a full or a partial export? This will help me to narrow down the logic scenarios as I try to replicate your issue.

Can you confirm the source and destination server versions for me, I can see that your destination server is 2019.3.3 based on your log output, but it is unclear what your source server version is? I ask to understand exactly what version of our code we should be trying to diagnose errors for.

Can you share the command line parameters that you’re using to trigger both the export and the import? This is very useful for when I start attempting to replicate your issue.

Kind regards,

Hello Jim,

Sorry for the late reply. I was not able to share the Database’s backup however, I got the other parts needed.
We’re performing a full export. and I confirm that the sandbox’s version is 2019.3.3 . However it was also occurring in older version 2018.5.4 ( that’s why we upgraded , trying to troubleshoot this issue).

The commands below are using octo.exe:
export --server=http:// --apikey=API-xxx --type=project --name="{ServiceName}" --filepath “{Filepath}”
import --server=https:// --apiKey=API-yyy --type=project --filePath="{Filepath}"

Hi Khaled,

The octo.exe import/export commands have been superseded by the use of octopus.migrator partial-export/import commands for newer versions of Octopus (especially post-spaces which was introduced in 2019.1).

I hope that helps.

Thank you and best regards,
Henrik