Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"raisely local" not working #52

Open
jw176 opened this issue Jun 4, 2024 · 3 comments
Open

"raisely local" not working #52

jw176 opened this issue Jun 4, 2024 · 3 comments

Comments

@jw176
Copy link

jw176 commented Jun 4, 2024

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

@jw176 jw176 changed the title "raisely local not working "raisely local" not working Jun 4, 2024
@alexey-systemseed
Copy link

I have the same problem.

@ParachuteDigital
Copy link

We have the same issue

@ParachuteDigital
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants