Spec failures: 404 error loading webpack javascript, JS fails to run as a result
Per https://gitlab.com/gitlab-org/gitlab-ce/issues/40771#note_55787056
When running JS specs locally, e.g.:
be rspec spec/features/projects/import_export/namespace_export_file_spec.rb:36
log/test.log has content like:
Started GET "/assets/webpack/webpack_runtime.bundle.js" for 127.0.0.1 at 2018-01-24 09:56:11 +0000
Processing by ApplicationController#route_not_found as JS
Parameters: {"unmatched_route"=>"assets/webpack/webpack_runtime.bundle"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Identity Exists (0.1ms) SELECT 1 AS one FROM "identities" WHERE "identities"."user_id" = $1 AND (provider LIKE 'ldap%' AND extern_uid IS NOT NULL) LIMIT 1 [["user_id", 1]]
Completed 404 Not Found in 7ms (ActiveRecord: 0.3ms)
Started GET "/assets/webpack/common.bundle.js" for 127.0.0.1 at 2018-01-24 09:56:12 +0000
Processing by ApplicationController#route_not_found as JS
Parameters: {"unmatched_route"=>"assets/webpack/common.bundle"}
User Load (3.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Identity Exists (0.2ms) SELECT 1 AS one FROM "identities" WHERE "identities"."user_id" = $1 AND (provider LIKE 'ldap%' AND extern_uid IS NOT NULL) LIMIT 1 [["user_id", 1]]
Completed 404 Not Found in 11ms (ActiveRecord: 3.8ms)
Started GET "/assets/webpack/main.bundle.js" for 127.0.0.1 at 2018-01-24 09:56:12 +0000
Processing by ApplicationController#route_not_found as JS
Parameters: {"unmatched_route"=>"assets/webpack/main.bundle"}
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Identity Exists (0.2ms) SELECT 1 AS one FROM "identities" WHERE "identities"."user_id" = $1 AND (provider LIKE 'ldap%' AND extern_uid IS NOT NULL) LIMIT 1 [["user_id", 1]]
Completed 404 Not Found in 6ms (ActiveRecord: 0.5ms)
Started GET "/assets/webpack/test.bundle.js" for 127.0.0.1 at 2018-01-24 09:56:12 +0000
Processing by ApplicationController#route_not_found as JS
Parameters: {"unmatched_route"=>"assets/webpack/test.bundle"}
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Identity Exists (0.2ms) SELECT 1 AS one FROM "identities" WHERE "identities"."user_id" = $1 AND (provider LIKE 'ldap%' AND extern_uid IS NOT NULL) LIMIT 1 [["user_id", 1]]
Completed 404 Not Found in 6ms (ActiveRecord: 0.4ms)
Started GET "/assets/webpack/webpack_runtime.bundle.js" for 127.0.0.1 at 2018-01-24 09:56:12 +0000
Processing by ApplicationController#route_not_found as JS
Parameters: {"unmatched_route"=>"assets/webpack/webpack_runtime.bundle"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Identity Exists (0.1ms) SELECT 1 AS one FROM "identities" WHERE "identities"."user_id" = $1 AND (provider LIKE 'ldap%' AND extern_uid IS NOT NULL) LIMIT 1 [["user_id", 1]]
Completed 404 Not Found in 5ms (ActiveRecord: 0.3ms)
In this particular spec, we're clicking a link that has data-method=post
. This is not interpreted, the browser makes a GET request instead, and gets a further 404 failure as a result.
Should these requests be going to Rails, or directly to webpack? What's the story here?
I believe we precompile assets in CI, so perhaps that's why we don't see problems there..