Skip to content

🐛 [Bug]: Pushing stories doesn't respect folder structure, pushes all stories to the root folder #424

@angelikatyborska

Description

@angelikatyborska

Package

storyblok (CLI)

Bug Description

The command to push all stories does not respect the story folder structure. It creates all stories in the root folder.

Note that the command output spits out some generic API errors every few seconds. They might or might not be related to this bug - I did not figure out yet why they happen.

Another problem, I'm also unsure if it's related or not: the stories that were copied do not have the correct content type. They're all of content-type "Tmp".

This is a screenshot of my source space content on the left and my target space content on the right, after the push.

Image

Steps to Reproduce

  1. Have a space, "space A", with some existing data, a little bit but not too much.
  2. Make sure "space A" has some folders and stories inside folders, e.g. posts/hello-world
  3. Duplicate "space A" as "space A copy"
  4. Pull all components from "space A"
  5. Pull all components from "space A copy"
  6. Pull all stories from "space A"
  7. Push all stories from "space A" to "space A copy"

Expected Behavior

No new content should have been created in "space A copy" because it was just duplicated from "space A" and didn't have any differences in content.

Actual Behavior

All stories that were in folders in "space A" got created in the root folder of "space A copy". E.g. the story hello-world was created in the root folder even though in the source space it was inside a posts/ folder.

Code Sample

Environment

System:
    OS: macOS 26.2
    CPU: (11) arm64 Apple M3 Pro
    Memory: 67.73 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.14.0 - /Users/angelikacathor/.asdf/installs/nodejs/22.14.0/bin/node
    npm: 11.2.0 - /Users/angelikacathor/.asdf/plugins/nodejs/shims/npm
    pnpm: 10.21.0 - /Users/angelikacathor/.asdf/installs/nodejs/22.14.0/bin/pnpm
    bun: 1.2.15 - /Users/angelikacathor/.bun/bin/bun
  Browsers:
    Brave Browser: 141.1.83.118
    Chrome: 144.0.7559.133
    Edge: 144.0.3719.104
    Firefox Developer Edition: 148.0
    Safari: 26.2
  npmPackages:
    @storyblok/astro: ^6.2.0 => 6.2.0 
    @storyblok/js: 3.5.0 => 3.5.0 
    astro: ^5.16.11 => 5.16.11 
    storyblok: ^4.14.1 => 4.14.1

Error Logs

$ ./node_modules/.bin/storyblok stories push --from 307034 --space 290333826823292 --verbose


  Storyblok CLI  


 Stories  Pushing stories...


 Creating Stories...    [                                        ] 0% | 0s | 0/16 processed
 Processing Stories...  [                                        ] 0% | 0s | 0/16 processed
 Error ng Stories...    [                                        ] 0% | 0s | 0/16 processed

▲ error Failed to create story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4014:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
.19.5_magicast@0.5.1/node_modules/storyblok/dist/index.mjs:8013:23)\n' +ents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22
/node_modules/storyblok/dist/index.mjs:8069:34',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
 Creating Stories...    [■■■■■                                   ] 12% | 15s | 2/16 processed
 Processing Stories...  [                                        ] 0% | 0s | 0/15 processed
 Error ng Stories...    [                                        ] 0% | 0s | 0/15 processed

▲ error Failed to create story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4014:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
.19.5_magicast@0.5.1/node_modules/storyblok/dist/index.mjs:8013:23)\n' +ents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22
/node_modules/storyblok/dist/index.mjs:8069:34',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
 Creating Stories...    [■■■■■■■■                                ] 18% | 10s | 3/16 processed
 Processing Stories...  [                                        ] 0% | 0s | 0/14 processed
 Updating Stories...    [                                        ] 0% | 0s | 0/14 processed Error 

▲ error Failed to create story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4014:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
.19.5_magicast@0.5.1/node_modules/storyblok/dist/index.mjs:8013:23)\n' +ents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22
/node_modules/storyblok/dist/index.mjs:8069:34',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
 Creating Stories...    [■■■■■■■■■■                              ] 25% | 8s | 4/16 processed
 Processing Stories...  [                                        ] 0% | 0s | 0/13 processed
 Updating Stories...    [                                        ] 0% | 0s | 0/13 processed Error 

▲ error Failed to create story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4014:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
.19.5_magicast@0.5.1/node_modules/storyblok/dist/index.mjs:8013:23)\n' +ents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22
/node_modules/storyblok/dist/index.mjs:8069:34',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
 Creating Stories...    [■■■■■■■■■■■■■                           ] 31% | 7s | 5/16 processed
 Processing Stories...  [                                        ] 0% | 0s | 0/12 processed
 Error ng Stories...    [                                        ] 0% | 0s | 0/12 processed

▲ error Failed to create story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4014:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
.19.5_magicast@0.5.1/node_modules/storyblok/dist/index.mjs:8013:23)\n' +ents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22
/node_modules/storyblok/dist/index.mjs:8069:34',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
 Creating Stories...    [■■■■■■■■■■■■■■■                         ] 37% | 5s | 6/16 processed
 Processing Stories...  [                                        ] 0% | 0s | 0/11 processed
 Error ng Stories...    [                                        ] 0% | 0s | 0/11 processed

▲ error Failed to create story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4014:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
.19.5_magicast@0.5.1/node_modules/storyblok/dist/index.mjs:8013:23)\n' +ents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22
/node_modules/storyblok/dist/index.mjs:8069:34',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
 Creating Stories...    [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■          ] 75% | 2s | 12/16 processed
 Processing Stories...  [                                        ] 0% | 0s | 0/10 processed
 Error ng Stories...    [                                        ] 0% | 0s | 0/10 processed

▲ error Failed to create story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4014:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
.19.5_magicast@0.5.1/node_modules/storyblok/dist/index.mjs:8013:23)\n' +ents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22
/node_modules/storyblok/dist/index.mjs:8069:34',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
 Creating Stories...    [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■       ] 81% | 2s | 13/16 processed
 Processing Stories...  [                                        ] 0% | 0s | 0/9 processed
 Error ng Stories...    [                                        ] 0% | 0s | 0/9 processed

▲ error Failed to create story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4014:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
.19.5_magicast@0.5.1/node_modules/storyblok/dist/index.mjs:8013:23)\n' +ents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22
/node_modules/storyblok/dist/index.mjs:8069:34',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
 Creating Stories...    [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  ] 93% | 1s | 15/16 processed
 Processing Stories...  [                                        ] 0% | 0s | 0/8 processed
 Error ng Stories...    [                                        ] 0% | 0s | 0/8 processed

▲ error Failed to create story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4014:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
.19.5_magicast@0.5.1/node_modules/storyblok/dist/index.mjs:8013:23)\n' +ents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22
/node_modules/storyblok/dist/index.mjs:8069:34',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
}

 Error 

▲ error Cannot read properties of null (reading 'component') 
▲ error Unexpected Error TypeError: Cannot read properties of null (reading 'component')
agicast@0.5.1/node_modules/storyblok/dist/index.mjs:7693:31)Documents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_m
0.5.1/node_modules/storyblok/dist/index.mjs:7840:14)Documents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@
ode@22.19.5_magicast@0.5.1/node_modules/storyblok/dist/index.mjs:7984:66)Documents/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+n
    at Transform._write (node:internal/streams/transform:171:8)
    at writeOrBuffer (node:internal/streams/writable:572:12)
    at _write (node:internal/streams/writable:501:10)
    at Writable.write (node:internal/streams/writable:510:10)
    at Readable.ondata (node:internal/streams/readable:1009:22)
    at Readable.emit (node:events:518:28)
 Creating Stories...    [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■] 100% | 0s | 16/16 processed
 Processing Stories...  [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■] 100% | 0s | 7/7 processed
 Error ng Stories...    [                                        ] 0% | 0s | 0/6 processed

▲ error Failed to update story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4038:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
/node_modules/storyblok/dist/index.mjs:8120:31',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
}

 Error ng Stories...    [■■■■■■■                                 ] 16% | 30s | 1/6 processed

▲ error Failed to update story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4038:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
/node_modules/storyblok/dist/index.mjs:8120:31',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
}

 Updating Stories...    [■■■■■■■■■■■■■                           ] 33% | 10s | 2/6 processed Error 

▲ error Failed to update story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4038:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
/node_modules/storyblok/dist/index.mjs:8120:31',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
}

 Error ng Stories...    [■■■■■■■■■■■■■■■■■■■■                    ] 50% | 6s | 3/6 processed

▲ error Failed to update story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4038:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
/node_modules/storyblok/dist/index.mjs:8120:31',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
}

 Error ng Stories...    [■■■■■■■■■■■■■■■■■■■■■■■■■■■             ] 66% | 3s | 4/6 processed

▲ error Failed to update story 
▲ error Error fetching data from the API 
▲ error API Error: Error fetching data from the API {
  name: 'API Error',
  message: 'Error fetching data from the API',
  httpCode: 0,
  cause: 'Error fetching data from the API',
  errorId: 'generic',
  stack: 'API Error: Error fetching data from the API\n' +
cast@0.5.1/node_modules/storyblok/dist/index.mjs:655:9)\n' +uments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magi
t@0.5.1/node_modules/storyblok/dist/index.mjs:4038:5)\n' +ments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicas
    '    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
/node_modules/storyblok/dist/index.mjs:8120:31',ocuments/code/storyblok-website/node_modules/.pnpm/storyblok@4.14.1_@types+node@22.19.5_magicast@0.5.1
  responseData: undefined
}

 Updating Stories...    [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■] 100% | 0s | 6/6 processed
ℹ Push results: 16 stories pushed, 9 stories failed

  Creating stories: 7/16 succeeded, 9 failed.
  Processing stories: 6/7 succeeded, 1 failed.
  Updating stories: 1/6 succeeded, 5 failed.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugcannot-reproduce[Status] is not consistently reproducible

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions