GitLab Project Import: Attempting to import a GitLab Export throws 404 due to namespace undefined
Summary
Whenever a user attempts to create a new project by importing a GitLab Export, the user gets a 404 because the namespace is undefined.
Steps to reproduce
- Create new project
- Choose "From Import"
- Choose from "GitLab Export".
- Get 404
Example Project
What is the current bug behavior?
Namespace in URL is always undefined
.
What is the expected correct behavior?
Use the namespace ID already in URL. If not present, default to personal namespace.
Relevant logs and/or screenshots
Kibana: https://log.gprd.gitlab.net/goto/1c823d8782c7ab11482cdb36c46fbd22
For some reason I couldn't find an entry in Sentry, but here's a copy of the stack trace and other info from Kibana:
json.correlation_id
01FHTK2NS7NDZ572YY42H8E0A9
json.environment
gprd
json.exception.backtrace
app/controllers/import/gitlab_projects_controller.rb:10:in `new', ee/lib/gitlab/ip_address_state.rb:10:in `with', ee/app/controllers/ee/application_controller.rb:44:in `set_current_ip_address', app/controllers/application_controller.rb:497:in `set_current_admin', lib/gitlab/session.rb:11:in `with_session', app/controllers/application_controller.rb:488:in `set_session_storage', lib/gitlab/i18n.rb:105:in `with_locale', lib/gitlab/i18n.rb:111:in `with_user_locale', app/controllers/application_controller.rb:482:in `set_locale', app/controllers/application_controller.rb:476:in `set_current_context', ee/lib/omni_auth/strategies/group_saml.rb:41:in `other_phase', lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in `call', lib/gitlab/middleware/rails_queue_duration.rb:33:in `call', lib/gitlab/middleware/speedscope.rb:13:in `call', lib/gitlab/request_profiler/middleware.rb:17:in `call', lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call', lib/gitlab/metrics/rack_middleware.rb:16:in `block in call', lib/gitlab/metrics/web_transaction.rb:21:in `run', lib/gitlab/metrics/rack_middleware.rb:16:in `call', lib/gitlab/jira/middleware.rb:19:in `call', lib/gitlab/middleware/go.rb:20:in `call', lib/gitlab/etag_caching/middleware.rb:21:in `call', lib/gitlab/middleware/multipart.rb:172:in `call', lib/gitlab/middleware/read_only/controller.rb:50:in `call', lib/gitlab/middleware/read_only.rb:18:in `call', lib/gitlab/middleware/same_site_cookies.rb:27:in `call', lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call', lib/gitlab/middleware/basic_health_check.rb:25:in `call', lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call', lib/gitlab/middleware/request_context.rb:21:in `call', config/initializers/fix_local_cache_middleware.rb:11:in `call', lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call', lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call', lib/gitlab/metrics/requests_rack_middleware.rb:75:in `call', lib/gitlab/middleware/release_env.rb:12:in `call'
json.exception.class
ActiveRecord::RecordNotFound
json.exception.message
Couldn't find Namespace with 'id'=undefined
From the 404 log entry:
69d179c4999730b3-ATL
json.component
gitlab
json.controller
Import::GitlabProjectsController
json.correlation_id
01FHTK2NS7NDZ572YY42H8E0A9
json.meta.caller_id
Import::GitlabProjectsController#new
json.meta.client_id
user/2454149
json.meta.feature_category
importers
json.method
GET
json.params
{
"key": "name",
"value": ""
},
{
"key": "namespace_id",
"value": "undefined"
},
{
"key": "path",
"value": ""
}
json.path
/import/gitlab_project/new
json.pid
52
json.status
404
Output of checks
GitLab.com, GitLab Enterprise Edition 14.4.0-pre 80746ab8
Workaround
Edit the URL by replacing the undefined' with the ID number of the namespace you want to import into:
http://gitlab.com/projects/new?namespace_id=12345#import_project`