Problem pushing slices to prismic

Having issues pushing slices to Prismic and cant resolve it. Is there any other way than to delete and remake the repo. Ive run into this a couple of times, and since I only had lik 2 slices i resolved it by creating a new repo. But Im getting to a point where its too much work to remake it every time.

I have no errors in storybook what so ever so have to do with the repo (can save slice to file system).

Theres no info more than "An unexpected error occurred while trying to push the slice to Prismic".

Tried to look in the network panel, not that much more info there. Any ideas?

Forbidden, sounds like maybe you are not logged into Prismic on your local computer maybe?

From the command line run:
prismic login // and relogin

See if that helps.

I know, but I am logged in from terminal, can bootstrap new repos etc.

Thanks anyway!

Ha! Now I've had a chance to test the Slice Builder, we'll it's not working for me either.
Nothing uploads to Prismic.

When I press 'Push Slice to Prismic', the UI gets stuck with the loading spinner.

And the terminal outputs these errors:

[slice-machine] {
  e: Error: ENOENT: no such file or directory, open '/Users/me/projects/myproject/slices/IntroFour/preview.png'
      at Object.openSync (fs.js:462:3)
      at Object.readFileSync (fs.js:364:35)
      at Object.base64Sync (/Users/me/projects/myproject/node_modules/base64-img/base64-img.js:60:17)
      at _callee2$ (/Users/me/projects/myproject/node_modules/slice-machine-ui/server/api/push.js:46:34)
      at tryCatch (/Users/me/projects/myproject/node_modules/regenerator-runtime/runtime.js:63:40)
      at Generator.invoke [as _invoke] (/Users/me/projects/myproject/node_modules/regenerator-runtime/runtime.js:293:22)
      at Generator.next (/Users/me/projects/myproject/node_modules/regenerator-runtime/runtime.js:118:21)
      at asyncGeneratorStep (/Users/me/projects/myproject/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
      at _next (/Users/me/projects/myproject/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
      at runMicrotasks (<anonymous>) {
    errno: -2,
    syscall: 'open',
    code: 'ENOENT',
    path: '/Users/me/projects/myproject/slices/IntroFour/preview.png'
  }
}

[slice-machine] (node:76555) UnhandledPromiseRejectionWarning: RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: undefined
    at ServerResponse.writeHead (_http_server.js:248:11)
    at ServerResponse._implicitHeader (_http_server.js:239:8)
    at write_ (_http_outgoing.js:642:9)
    at ServerResponse.end (_http_outgoing.js:753:5)
    at ServerResponse.send (/Users/me/projects/myproject/node_modules/express/lib/response.js:221:10)
    at ServerResponse.json (/Users/me/projects/myproject/node_modules/express/lib/response.js:267:15)
    at _callee6$ (/Users/me/projects/myproject/node_modules/slice-machine-ui/server/api/index.js:52:39)
    at tryCatch (/Users/me/projects/myproject/node_modules/regenerator-runtime/runtime.js:63:40)
    at Generator.invoke [as _invoke] (/Users/me/projects/myproject/node_modules/regenerator-runtime/runtime.js:293:22)
    at Generator.next (/Users/me/projects/myproject/node_modules/regenerator-runtime/runtime.js:118:21)
(node:76555) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 21)

Sounds like it didnt produce a screenshot for you? Tried to manually create one?

This one is solved for me, all of a sudden it worked again. Got to have something to do with the CLI login imo.

Hi Team,

Yes I think this is to do with the authentication for the Slices API. You would need to prismic logout then prismic login to get the token necessary to be able to push your Slices.

@online Can you show me the file structure for the folder of one of your Slices. Are these newly created slices or ones created before the slice builder was released?

Thanks.

Ok, ran in to this again. To fix it if anybody else experience the same thing:

  1. Exit slicemachine ui server.
  2. Login to Prismic CLI again with: prismic login.
  3. Restart slicemachine server with: yarn slicemachine

I think the first times I just logged out/in, but the server needs a restart as well!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.