Deploy error - Cannot destructure property 'theme' of 'undefined'
paultalarian opened this issue · comments
Hi,
I'm not able to deploy my theme anymore, as I used to do. I don't think I changed anything here.
I'm using the online version of Ghost.
This is the error I face:
Error [InternalServerError]: Cannot destructure property 'theme' of 'undefined' as it is undefined.
at /home/runner/work/_actions/TryGhost/action-deploy-theme/v1.4.0/dist/index.js:7300:33
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async main (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.4.0/dist/index.js:1572:9) {
name: 'InternalServerError',
context: null,
type: 'InternalServerError',
details: null,
property: null,
help: null,
code: null,
id: '2b380560-e096-11eb-97cd-e1a27588ea00'
}
This is my config:
name: Deploy Theme
on:
push:
branches:
- master
- main
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Deploy Ghost Theme
uses: TryGhost/action-deploy-theme@v1.4.0
with:
api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}
@paultalarian
Just noted as having the same issue, even tried setting "theme-name" configuration key via GitHub secret and main.yml as below:
name: Deploy Theme
on:
push:
branches:
- master
- main
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: TryGhost/action-deploy-theme@v1.4.1
with:
api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}
theme-name: ${{ secrets.GHOST_THEME_NAME }}
Also need help with this issue as well
Same problem with my script on ghost.io :
const GhostAdminApi = require('@tryghost/admin-api');
(async function main() {
try {
const api = new GhostAdminApi({
url: process.env.url,
key: process.env.key,
version: 'canary'
});
// Deploy it to the configured site
await api.themes.upload({file: 'theme.zip'});
console.log('Theme successfully uploaded.');
} catch (err) {
console.error(err);
process.exit(1);
}
}());
Error [InternalServerError]: Cannot destructure property 'theme' of 'undefined' as it is undefined.
at /Users/potsky/Work/GitHubSirEnergies/www/node_modules/@tryghost/admin-api/lib/index.js:347:33
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async main (/Users/potsky/Work/GitHubSirEnergies/www/tools/index.js:12:5) {
context: null,
type: 'InternalServerError',
details: null,
property: null,
help: null,
code: null,
id: 'a09d0b30-e0ae-11eb-ae70-2f4d878239aa'
}
And when uploading manually the theme in the admin panel, I have the same error :
I have updated my local environement to Ghost 4.9.2 to build the theme
Fix: in package.json the naming convention needs to be unique. Please see below for the convention that I am now using when deploying.
Commit 1
"name": "casper-new-09072021-01"
Commit 2
"name": "casper-new-09072021-02"
{
"name": "casper-new-09072021-01",
"description": "A clean, minimal default theme for the Ghost publishing platform",
"demo": "https://demo.ghost.io",
"version": "4.1.2",
"engines": {
"ghost": ">=4.0.0",
"ghost-api": "v4"
}
}
Hope this helps and makes sense
Thank you @endk17
The deploy still fails with the same error BUT the theme is installed and the website broken.
What a pity...
Ok, bug is resolved and came from ghost.org...
Our team is aware of an issue related to uploading themes, which we've just released a fix for. Are you able to clear your caches and give it another try?
Deploys are now running fine again !
Confirmed, it works again, thanks!
This is fixed in TryGhost/Ghost@4235753 which will be in the 4.9.3 release