Unable to push slices to prismic in slice-machine

For comparison, I also ran ran prismic sm --setup without the --no-prismic flag and i do not face [slices API]: Not Found. It seems that creating a repository during the CLI setup command also activates the Slices API for the new repository. (This is just what I think)

This time the only thing I had to do was to was to install a bunch of missing dependencies as @niki.brown did above

Hey @amir.s,

Yes, we need to make sure your repo is in the correct cluster on our side. Repos created with the Slice Machine CLI are on the right cluster by default, but others are not. I've moved docsportal to the Slice Machine cluster, so you should be fine. Let me know how it goes, and if you have any issues.

Best,
Sam

I am experiencing the same problem for the past days. For different versions of slice-machine-ui I saw another error message. Most as mention earlier. slice-machine-ui is now updated to version 0.0.43-alpha.5 but I'm still getting an error.

[slice-machine] Now running on http://localhost:9999 !

[slice-machine] {
  e: FetchError: request to http://localhost:4403/dev/create failed, reason: connect ECONNREFUSED 127.0.0.1:4403
      at ClientRequest.<anonymous> (/Users/guus/Sites/futy.io/futy.io-site/node_modules/node-fetch/lib/index.js:1461:11)
      at ClientRequest.emit (events.js:315:20)
      at ClientRequest.EventEmitter.emit (domain.js:486:12)
      at Socket.socketErrorListener (_http_client.js:469:9)
      at Socket.emit (events.js:315:20)
      at Socket.EventEmitter.emit (domain.js:486:12)
      at emitErrorNT (internal/streams/destroy.js:106:8)
      at emitErrorCloseNT (internal/streams/destroy.js:74:3)
      at processTicksAndRejections (internal/process/task_queues.js:80:21) {
    type: 'system',
    errno: 'ECONNREFUSED',
    code: 'ECONNREFUSED'
  }
}

[slice-machine] (node:81923) UnhandledPromiseRejectionWarning: RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: undefined
    at ServerResponse.writeHead (_http_server.js:255:11)
    at ServerResponse._implicitHeader (_http_server.js:246:8)
    at write_ (_http_outgoing.js:685:9)
    at ServerResponse.end (_http_outgoing.js:798:5)
    at ServerResponse.send (/Users/guus/Sites/futy.io/futy.io-site/node_modules/express/lib/response.js:221:10)
    at ServerResponse.json (/Users/guus/Sites/futy.io/futy.io-site/node_modules/express/lib/response.js:267:15)
    at _callee6$ (/Users/guus/Sites/futy.io/futy.io-site/node_modules/slice-machine-ui/server/api/index.js:55:39)
    at tryCatch (/Users/guus/Sites/futy.io/futy.io-site/node_modules/regenerator-runtime/runtime.js:63:40)
    at Generator.invoke [as _invoke] (/Users/guus/Sites/futy.io/futy.io-site/node_modules/regenerator-runtime/runtime.js:293:22)
    at Generator.next (/Users/guus/Sites/futy.io/futy.io-site/node_modules/regenerator-runtime/runtime.js:118:21)
(Use `node --trace-warnings ...` to show where the warning was created)

[slice-machine] (node:81923) 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: 1)
(node:81923) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I had a related issue with a preview image (generated within the framework) that was too large... could not upload slice to prismic. Replaced preview.png with a small custom one did the trick. Since the errors are not clear yet, I though it might be useful in this topic.

Another issue was an Invalid Path error in a richtext field, removed "rtl" solved it...

@guus, can you downgrade to 0.0.42? At the moment, most alpha versions break if you're not running the proper services locally. Do you think we could make it clearer by using another tag (like unstable, local-only...)?

Errors related to ENOENT: no such file or directory should be fixed with 0.0.42. If you still get an issue while updating model locally, please check if you're missing screenshots in .slicemachine/assets/[your-lib]/...

We found an issue with how images are handled at the moment, which is why some of you get 413 errors when pushing to Prismic or when saving slices in your custom types. We're actively working on it and will provide a fix as soon as possible

1 Like

Hey @samlittlefair , I'm able to run develop now, thanks!

2 Likes

Thanks @hugo.villain, I got it working!

First I tried to downgrade to 0.0.42 (also removed node_modules, prismic logout/login, etc) in the same Nuxt app. But then I still got an error: Error: Cannot find module 'formdata-node'. After that, I did a fresh Nuxt installation and followed the installation steps again, and got it working. Thanks for your help, I appreciate that!

Awesome to hear @guus! We're still in the early phases of the project and things are still a bit rough around the edges. As soon as the fix for images is done, we'll spend some time making the whole process a bit more robust!

@niki.brown, Just to make sure you saw Hugo's message below:

There's currently an issue with images that causes the 413 error. The preview image gets encoded and included in the request, which causes the "request to large" error. The team is working on a fix right now, and we'll let you know as soon as it's done :slight_smile:

@samlittlefair Thanks for the update!

As the image is a bit too large, and it returns 413, as a quick dirty fix it is possible to go to mocks.json of the component that has the image, remove the example image by replacing the URL to "url": ""

And finally on slicemachine UI, you will be able to push that to prismic. You don't need to regenerate the preview.

I still have issues pushing slices, returning "Invalid Paths" error in my terminal. Removing all options except 'paragraph' (in repeatable zone field: config.multi) "fixed" it. Any idea what's going wrong?

Hey @baholza,

This sounds like it could be the list item error that Phil mentioned here:

Do you have a list in your custom type? If so, try Phil's troubleshooting steps and let me know if that helps. We'll be pushing a fix for that error shortly.

If that's not the issue, could you use an app like Giphy to do a screen recording of the error so we can try to debug it? And could you also send your project files, in a .zip file or a GItHub repo? (You can send all of this by DM if you like.)

Sam

Hey @DavidParys! Welcome to the Prismic community, and thanks for posting this workaround :slight_smile:

Yup, list items were the issue, missed that post. Thanks @samlittlefair!

1 Like

@baholza You didn't miss it! I added that point after you asked the question, so thanks to you :slight_smile:

For any issues with push in Slice Machine, please see this thread: