craftcms / craftcms/cms

503 cpresources on migration. cpresources not being created properly?

Open
#2,868 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

Description

cpresources show up as 503 error when migrating a craft 2 site

Steps to reproduce
  1. Update craft2 site to 2.6.2996
  2. Install composer require craftcms/cms:^3.0.0 in /craft directory
  3. Change index.php to
<?php

// Path to your craft/ folder
$craftPath = '../craft';

defined('CRAFT_BASE_PATH') || define('CRAFT_BASE_PATH', realpath($craftPath));

if (!is_dir(CRAFT_BASE_PATH.'/vendor')) {
  exit('Could not find your vendor/ folder. Please ensure that <strong><code>$craftPath</code></strong> is set correctly in '.__FILE__);
}

require_once CRAFT_BASE_PATH.'/vendor/autoload.php';
$app = require CRAFT_BASE_PATH.'/vendor/craftcms/cms/bootstrap/web.php';
$app->run();
  1. Go to https://www.yoursite.com/admin

You should see the craft3 installation without any styles. If you inspect console it will show all css and scripts as

GET https://www.yoursite.com/cpresources/9315f24d/jquery-ui.min.js 503 (Service Unavailable)

There is an folder structure of cpresources in the public directory. No files are in these folders. May be left from original site.

Composer seems to install the scripts not into cpresources as there is no other folder but instead to
yoursite/craft/vendor/craftcms/cms/src/web/assets/

For instance Install.min.js gets
GET http://www.yoursite.com/cpresources/1fb4f109/install.min.js 503 (Service Unavailable)

the file seems to be located at

yoursite/craft/vendor/craftcms/cms/src/web/assets/installer/dist

not where it is looking in cpresources

Additional info
  • Craft version: 2.6.2996 -> 3.0.0
  • PHP version: 7.1.17
  • Database driver & version: mysql Ver 14.14 Dist 5.6.30
  • Plugins & versions: Uninstalled in test

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the migration using the provided index.php and inspect the generated cpresources paths alongside craft/vendor/craftcms/cms/src/web/assets/. Trace the asset URL generation or publishing entry point responsible for the 503 responses. Done means the migrated admin loads its CSS and scripts from valid files.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.