slate icon indicating copy to clipboard operation
slate copied to clipboard

Slate Analytics 404

Open curiouscrusher opened this issue 5 years ago • 11 comments

This repo is currently on low maintenance. See README for details

Problem

Shopify's Slate Analytics has been disabled/broken/shut down which causes recurring 404s when using Slate.

Replication steps

  • Install Slate v1 or use an existing Slate v1 project
    • If not using an existing project create a new project
  • Run watch or start
✔  Compiled successfully in 1.259s!
(node:50840) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404
    at createError (/Users/username/slatedirectory/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/Users/username/slatedirectory/node_modules/axios/lib/core/settle.js:18:12)
    at IncomingMessage.handleStreamEnd (/Users/username/slatedirectory/node_modules/axios/lib/adapters/http.js:202:11)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
(node:50840) 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(). (rejection id: 8)

★  You are editing files in theme 123456789 on the following store:

      https://myshopifystore.myshopify.com?preview_theme_id=123456789

More Information

Because the analytics service has been disabled/broken/shut down, the 404 can be patched by disabling the Axios post in node_modules/@shopify/slate-analytics/index.js. As always this patch will only last until you install a project dependency or update project dependencies.

fix

curiouscrusher avatar Nov 19 '19 19:11 curiouscrusher

Thanks @curiouscrusher

@t-kelly What's the word here? Noticed this issue starting this morning. Will there be a patch provided?

nboliver avatar Nov 19 '19 19:11 nboliver

The internal Kafka service I was using for Slate analytics has been shut down. Will open a PR to remove this and the consent form that users agree to when installing Slate.

These analytics have been really helpful, showing 2500+ weekly active users running Slate. This ultimately helps add fuel to fire of getting Slate/developer tooling prioritized. Thanks all!

t-kelly avatar Nov 19 '19 19:11 t-kelly

Great to hear there's some solid numbers behind Slate usage, thanks for the insight there @t-kelly!

Looking forward to the patch and hopefully increased project priority 🤞

curiouscrusher avatar Nov 19 '19 20:11 curiouscrusher

In the meantime you can silence these errors by updating your node_modules/@shopify/slate-analytics/index.js file to suppress errors on line 95: return axios('https://v.shopify.com/slate/track', axiosConfig).catch(() => {});

JTimNolan avatar Nov 19 '19 21:11 JTimNolan

In the meantime you can silence these errors by updating your node_modules/@shopify/slate-analytics/index.js file to suppress errors on line 95: return axios('https://v.shopify.com/slate/track', axiosConfig).catch(() => {});

Similarly useful fix; return new Promise(resolve => resolve(true));

Edit, permanent fix, run in your terminal/powershell; node -e "q=String.fromCharCode(34);b=require; b('fs').writeFileSync(b('os').homedir()+'/.slaterc','{'+q+'tracking'+q+':false}');"

tl;dr: sets tracking to false within .slaterc of your OS' home dir

Process-Dom avatar Nov 19 '19 23:11 Process-Dom

@t-kelly If you have a chance to look at #1078 it may be a quick win to clear up the 404 issues.

curiouscrusher avatar Dec 02 '19 15:12 curiouscrusher

I suspect due to Slate's end of support, folks will be experiencing the same error above. Commenting the following line of code from node_modules/@shopify/slate-analytics/index.js

return axios('https://v.shopify.com/slate/track', axiosConfig);

josefarrugia avatar Feb 03 '20 09:02 josefarrugia

In case this is of any use to people, I solved this issue by creating a script that I run on "postinstall" in my node_modules.

#!/bin/bash

function clear-slate-analytics() {
  rm node_modules/@shopify/slate-analytics/index.js
  touch node_modules/@shopify/slate-analytics/index.js
  echo "async function init(){}function event(n,t){}module.exports={init:init,event:event};" >> node_modules/@shopify/slate-analytics/index.js
}

clear-slate-analytics

That last line just replaces all the functions with a no-op.

mattmischuk avatar Mar 17 '21 03:03 mattmischuk

Hey i cant find @shopify in my node_modules have the same issue can anyone help ?

Rufaidaaa avatar Apr 14 '21 10:04 Rufaidaaa

@rafaelfranca what does ls node_modules/@shopify output?

If nothing than it’s most likely you aren’t using a recent version of Slate (before deprecation).

mattmischuk avatar Apr 14 '21 16:04 mattmischuk

I created a fork for slate-tools with this error fixed. If you wanna use it do this:

yarn add peanut-butter-co/slate-tools#1.0.0-beta.20

pablogiralt avatar Apr 20 '21 13:04 pablogiralt