500: undefined method `map' for nil:NilClass in graphql on request tag list with external registry
Summary
Error "Something went wrong while fetching the repository list." in page with image repository page
Steps to reproduce
Gitlab ce https://gitlab.com/gitlab-org/gitlab-foss/-/tags/v14.10.2 with external registry:2.7 deployed on standalone host
- config external registry with auth via gitlab, with letsencrypt cert written in gitlab.rb ... registry works itself
- create repo
- create image with tag from repo
- push image with tag
- push image to the same registry repo but with another tag
- try to delete image in registry repo with second tag
- refresh page with tags in registry repo
Example Project
What is the current bug behavior?
What is the expected correct behavior?
Relevant logs and/or screenshots
log about 500 from graphql request
{
"method": "POST",
"path": "/api/graphql",
"format": "*/*",
"controller": "GraphqlController",
"action": "execute",
"status": 500,
"time": "2022-06-15T09:44:29.237Z",
"params": [
{
"key": "_json",
"value": [
{
"operationName": "getContainerRepositoryTags",
"variables": "[FILTERED]",
"query": "query getContainerRepositoryTags($id: ID!, $first: Int, $last: Int, $after: String, $before: String, $name: String, $sort: ContainerRepositoryTagSort) {\n containerRepository(id: $id) {\n id\n tagsCount\n tags(\n after: $after\n before: $before\n first: $first\n last: $last\n name: $name\n sort: $sort\n ) {\n nodes {\n digest\n location\n path\n name\n revision\n shortRevision\n createdAt\n totalSize\n canDelete\n __typename\n }\n pageInfo {\n ...PageInfo\n __typename\n }\n __typename\n }\n __typename\n }\n}\n\nfragment PageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n __typename\n}\n"
}
]
},
{
"key": "graphql",
"value": {
"_json": [
{
"operationName": "getContainerRepositoryTags",
"variables": "[FILTERED]",
"query": "query getContainerRepositoryTags($id: ID!, $first: Int, $last: Int, $after: String, $before: String, $name: String, $sort: ContainerRepositoryTagSort) {\n containerRepository(id: $id) {\n id\n tagsCount\n tags(\n after: $after\n before: $before\n first: $first\n last: $last\n name: $name\n sort: $sort\n ) {\n nodes {\n digest\n location\n path\n name\n revision\n shortRevision\n createdAt\n totalSize\n canDelete\n __typename\n }\n pageInfo {\n ...PageInfo\n __typename\n }\n __typename\n }\n __typename\n }\n}\n\nfragment PageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n __typename\n}\n"
}
]
}
}
],
"correlation_id": "01G5KC000981S79HM5P1Y1WW5F",
"meta.user": "user",
"meta.client_id": "user/208",
"meta.caller_id": "GraphqlController#execute",
"meta.remote_ip": "ip",
"meta.feature_category": "container_registry",
"graphql": [
{
"depth": 4,
"complexity": 26,
"used_fields": [
"ContainerRepositoryDetails.id",
"ContainerRepositoryDetails.tagsCount",
"ContainerRepositoryTag.digest",
"ContainerRepositoryTag.location",
"ContainerRepositoryTag.path",
"ContainerRepositoryTag.name",
"ContainerRepositoryTag.revision",
"ContainerRepositoryTag.shortRevision",
"ContainerRepositoryTag.createdAt",
"ContainerRepositoryTag.totalSize",
"ContainerRepositoryTag.canDelete",
"ContainerRepositoryTag.__typename",
"ContainerRepositoryTagConnection.nodes",
"PageInfo.__typename",
"PageInfo.hasNextPage",
"PageInfo.hasPreviousPage",
"PageInfo.startCursor",
"PageInfo.endCursor",
"ContainerRepositoryTagConnection.pageInfo",
"ContainerRepositoryTagConnection.__typename",
"ContainerRepositoryDetails.tags",
"ContainerRepositoryDetails.__typename",
"Query.containerRepository"
],
"used_deprecated_fields": [],
"variables": "{\"id\"=>\"gid://gitlab/ContainerRepository/70\", \"first\"=>10, \"name\"=>\"\", \"sort\"=>\"NAME_ASC\"}",
"operation_name": "getContainerRepositoryTags"
}
],
"remote_ip": "ip",
"user_id": 208,
"username": "user",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0",
"request_urgency": "low",
"target_duration_s": 5,
"redis_calls": 4,
"redis_duration_s": 0.0008179999999999999,
"redis_read_bytes": 189,
"redis_write_bytes": 1381,
"redis_shared_state_calls": 1,
"redis_shared_state_duration_s": 0.000105,
"redis_shared_state_write_bytes": 55,
"redis_rate_limiting_calls": 2,
"redis_rate_limiting_duration_s": 0.00053,
"redis_rate_limiting_read_bytes": 5,
"redis_rate_limiting_write_bytes": 146,
"redis_sessions_calls": 1,
"redis_sessions_duration_s": 0.000183,
"redis_sessions_read_bytes": 184,
"redis_sessions_write_bytes": 1180,
"db_count": 6,
"db_write_count": 0,
"db_cached_count": 0,
"db_replica_count": 0,
"db_primary_count": 6,
"db_main_count": 6,
"db_main_replica_count": 0,
"db_replica_cached_count": 0,
"db_primary_cached_count": 0,
"db_main_cached_count": 0,
"db_main_replica_cached_count": 0,
"db_replica_wal_count": 0,
"db_primary_wal_count": 0,
"db_main_wal_count": 0,
"db_main_replica_wal_count": 0,
"db_replica_wal_cached_count": 0,
"db_primary_wal_cached_count": 0,
"db_main_wal_cached_count": 0,
"db_main_replica_wal_cached_count": 0,
"db_replica_duration_s": 0,
"db_primary_duration_s": 0.004,
"db_main_duration_s": 0.004,
"db_main_replica_duration_s": 0,
"rack_attack_redis_count": 1,
"rack_attack_redis_duration_s": 0.0006584757938981056,
"cpu_s": 0.148918,
"mem_objects": 46092,
"mem_bytes": 5226528,
"mem_mallocs": 11278,
"mem_total_bytes": 7070208,
"pid": 222235,
"exception.class": "NoMethodError",
"exception.message": "undefined method `map' for nil:NilClass",
"exception.backtrace": [
"lib/container_registry/tag.rb:93:in `block in layers'",
"lib/gitlab/utils/strong_memoize.rb:30:in `strong_memoize'",
"lib/container_registry/tag.rb:90:in `layers'",
"lib/container_registry/tag.rb:105:in `total_size'",
"lib/gitlab/graphql/present/field_extension.rb:18:in `resolve'",
"lib/gitlab/graphql/tracers/timer_tracer.rb:20:in `trace'",
"lib/gitlab/graphql/tracers/logger_tracer.rb:14:in `trace'",
"lib/gitlab/graphql/tracers/metrics_tracer.rb:13:in `trace'",
"lib/gitlab/graphql/tracers/application_context_tracer.rb:23:in `trace'",
"lib/gitlab/graphql/tracers/timer_tracer.rb:20:in `trace'",
"lib/gitlab/graphql/generic_tracing.rb:40:in `with_labkit_tracing'",
"lib/gitlab/graphql/generic_tracing.rb:30:in `platform_trace'",
"lib/gitlab/graphql/tracers/logger_tracer.rb:14:in `trace'",
"lib/gitlab/graphql/tracers/metrics_tracer.rb:13:in `trace'",
"lib/gitlab/graphql/tracers/application_context_tracer.rb:23:in `trace'",
"lib/gitlab/graphql/tracers/timer_tracer.rb:20:in `trace'",
"lib/gitlab/graphql/generic_tracing.rb:40:in `with_labkit_tracing'",
"lib/gitlab/graphql/generic_tracing.rb:30:in `platform_trace'",
"lib/gitlab/graphql/tracers/logger_tracer.rb:14:in `trace'",
"lib/gitlab/graphql/tracers/metrics_tracer.rb:13:in `trace'",
"lib/gitlab/graphql/tracers/application_context_tracer.rb:23:in `trace'",
"app/graphql/gitlab_schema.rb:49:in `multiplex'",
"app/controllers/graphql_controller.rb:153:in `execute_multiplex'",
"app/controllers/graphql_controller.rb:57:in `execute'",
"app/controllers/application_controller.rb:520:in `set_current_admin'",
"lib/gitlab/session.rb:11:in `with_session'",
"app/controllers/application_controller.rb:511: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:505:in `set_locale'",
"app/controllers/application_controller.rb:499:in `set_current_context'",
"lib/gitlab/middleware/memory_report.rb:13: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/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/query_analyzer.rb:11:in `block in call'",
"lib/gitlab/database/query_analyzer.rb:46:in `within'",
"lib/gitlab/middleware/query_analyzer.rb:11:in `call'",
"lib/gitlab/middleware/multipart.rb:173: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'",
"lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'",
"config/initializers/fix_local_cache_middleware.rb:11:in `call'",
"lib/gitlab/middleware/compressed_json.rb:26: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:77:in `call'",
"lib/gitlab/middleware/release_env.rb:13:in `call'"
],
"db_duration_s": 0,
"view_duration_s": 0.00018,
"duration_s": 1.31111
}
gitlab went to registry tags:
172.17.5.2 - - [15/Jun/2022:10:11:02 +0000] "GET /v2/${REPO}/tags/list HTTP/1.1" 200 133 "" "GitLab/14.10.2"
172.17.5.2 - - [15/Jun/2022:10:11:02 +0000] "GET /v2/${REPO}/tags/list HTTP/1.1" 200 133 "" "GitLab/14.10.2"
172.17.5.2 - - [15/Jun/2022:10:11:03 +0000] "HEAD /v2/${REPO}/manifests/latest HTTP/1.1" 200 3675 "" "GitLab/14.10.2"
172.17.5.2 - - [15/Jun/2022:10:11:03 +0000] "GET /v2/${REPO}/manifests/latest HTTP/1.1" 200 3675 "" "GitLab/14.10.2"
172.17.5.2 - - [15/Jun/2022:10:11:03 +0000] "GET /v2/${REPO}/blobs/sha256:ae57f5cb07bf6cf965a48f48ad4d9476dc18350a843a9d5ea9742808c6048679 HTTP/1.1" 200 12376 "" "GitLab/14.10.2"
172.17.5.2 - - [15/Jun/2022:10:11:03 +0000] "HEAD /v2/${REPO}/manifests/main-dev HTTP/1.1" 200 3678 "" "GitLab/14.10.2"
172.17.5.2 - - [15/Jun/2022:10:11:03 +0000] "GET /v2/${REPO}/manifests/main-dev HTTP/1.1" 200 3678 "" "GitLab/14.10.2"
172.17.5.2 - - [15/Jun/2022:10:11:03 +0000] "GET /v2/${REPO}/blobs/sha256:31d8f64f67afa419e57fc4d15ebf542ba588116a87d6909398e8289ec5eef835 HTTP/1.1" 200 12713 "" "GitLab/14.10.2"
172.17.5.2 - - [15/Jun/2022:10:11:03 +0000] "HEAD /v2/${REPO}/manifests/main-prod HTTP/1.1" 200 3467 "" "GitLab/14.10.2"
172.17.5.2 - - [15/Jun/2022:10:11:03 +0000] "GET /v2/${REPO}/manifests/main-prod HTTP/1.1" 200 3467 "" "GitLab/14.10.2"
but the Root image repo catched a error
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
System information
System:
Current User: git
Using RVM: no
Ruby Version: 2.7.5p203
Gem Version: 3.1.4
Bundler Version:2.2.33
Rake Version: 13.0.6
Redis Version: 6.2.6
Sidekiq Version:6.4.0
Go Version: unknown
GitLab information
Version: 14.10.2
Revision: 07d12f3fd11
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 12.7
URL: https://<gitlab_url>
HTTP Clone URL: https://<gitlab_url>/some-group/some-project.git
SSH Clone URL: git@<gitlab_url>:some-group/some-project.git
Using LDAP: yes
Using Omniauth: yes
Omniauth Providers:
GitLab Shell
Version: 13.25.1
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab subtasks ...
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 13.25.1 ? ... OK (13.25.1)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Internal API available: OK
Redis available via internal API: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes
Number of Sidekiq processes (cluster/worker) ... 1/1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... Server: ldapmain
not verifying SSL hostname of LDAPS server '${INTERNAL_LDAP}:636'
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
User output sanitized. Found 100 users of 100 limit.
Checking LDAP ... Finished
Checking GitLab App ...
Database config exists? ... yes
All migrations up? ... no
Try fixing it:
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production ## gitlab just works
Please fix the error above and rerun the checks.
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Projects have namespace: ...
65/4 ... yes
2/8 ... yes
... yes
65/13 ... yes
384/519 ... yes
4/520 ... yes
384/521 ... yes
Redis version >= 5.0.0? ... yes
Ruby version >= 2.7.2 ? ... yes (2.7.5)
Git user has default SSH configuration? ... yes
Active users: ... 148
Is authorized keys file accessible? ... yes
GitLab configured to store new projects in hashed storage? ... yes
All projects are in hashed storage? ... yes
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
part of gitlab.rb
registry_external_url 'https://${FILTERED_REGISTRY_URL}:443'
registry_nginx['ssl_certificate'] = "/etc/gitlab/${FILTERED_REGISTRY_URL}/cert.pem"
registry_nginx['ssl_certificate_key'] = "/etc/gitlab/${FILTERED_REGISTRY_URL}/privkey.pem"
gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_host'] = "${FILTERED_REGISTRY_URL}"
gitlab_rails['registry_port'] = "443"
registry['internal_key'] = "-----BEGIN RSA PRIVATE KEY-----...\n-----END RSA PRIVATE KEY-----\n"
gitlab_rails['registry_api_url'] = "https://${FILTERED_REGISTRY_URL}:443"
gitlab_rails['registry_key_path'] = "/etc/gitlab/key-registry.pem"
gitlab_rails['registry_issuer'] = "omnibus-gitlab-issuer"
registry['enable'] = false
Possible fixes
hint may be here
"exception.class": "NoMethodError",
"exception.message": "undefined method `map' for nil:NilClass",
"exception.backtrace": [
"lib/container_registry/tag.rb:93:in `block in layers'",
"lib/gitlab/utils/strong_memoize.rb:30:in `strong_memoize'",
Edited by Ilya

