raisely/cli

"raisely local" not working

Opened this issue · 3 comments

I'm unable to get raisely local to work for the following reasons:

  • The local dev server (http://localhost:8015/) redirects straight to the live site (which is not using a custom domain currently).
  • The changes made to local scss file are not detected by the CLI (there is no change in terminal output similar to how raisely start behaves)

Any help with this issue would be appreciated. Thanks

I have the same problem.

We have the same issue

Ok, I got a dirty-but-functional workaround in case you guys @jw176 and @alexey-systemseed still have this issue (or anyone else until Raisely deploys an actual fix)

NOTE: This is working for me but it's not the official solution (plus I ChatGpt'd the hell out of it). Use at your own risk.

There are 2 issues:
1) The script on raisely local targets the URL using yourcampaing.raisely.com which redirects to yourcampaing.raiselysite.com preventing the proxy interception.
FIX (Pull request sent):

  1. This one is easy, you need to locate the directory where Raisely CLI was installed (in my case C:\Users\<YOUR_USER_NAME>\AppData\Roaming\npm\node_modules\@raisely
  2. Navigate to @raisely\cli\src and open the file "local.js"
  3. On line 78 change https://${campaign.path}.raisely.com for https://${campaign.path}.raiselysite.com
  4. SAVE the file

That will stop the redirect, and running raisely local will actually open your localhost, but you'll see weird codes. That's because the content is compressed with zstd, which is the second issue

2) Response to intercept is compressed with zstd
FIX:
This fix has 2 parts, installing zstd on your computer and adding a library/code to the Raisely CLI project

  1. Installing zstd: I won't go into the details because it depends on your OS, but here's the official repo: https://github.com/facebook/zstd (on Win I had to download the win64 version, unzip it on C:\zstd\ and add that PATH to my system's Environment Variables). Feel free to google (or ask ChatGPT for more details)
  2. Once installed, you need to open the terminal on the folder @raisely\cli\ and run npm i simple-zstd (Source)
  3. After installing it, go back to the local.js file and replace the line 142 that currently should looks like this:
const response = responseBuffer.toString('utf8'); // convert buffer to string

for this:

const response = await new Promise((resolve, reject) => {
						const decompressedChunks = [];
						const decompressStream = ZSTDDecompress();

						decompressStream.on('data', (chunk) => decompressedChunks.push(chunk));
						decompressStream.on('end', () => resolve(Buffer.concat(decompressedChunks).toString('utf8')));
						decompressStream.on('error', reject);

						decompressStream.end(responseBuffer);
					});
  1. Finally add the import of ZSTDDecompress at the top of the file with import { ZSTDDecompress } from 'simple-zstd'; and SAVE

Run raisely local again, and that should work now