How to consistantly launch localserver and frontend-2 in speckle-server 2.24.2 locally?

Hey Everyone,

I’m just updating the local project I’ve been working on to the latest 2.24.2 speckle-server. However, the sign-up /sign-in page on my system seems to be hung.

  • Background: I’m new to webdev so I apologize if some if this is rudimentary stuff. This is the first time I’ve used Yarn to launch local servers, and it has honestly been super frustrating. As far as I understand it, I believe it should function similarly to npm run dev, except for launching all packages. And you terminate it by doing Ctrl+Z but often than not, this approach rarely works smoothly, and the only workaround I’ve found has been to follow the local server build steps, starting from yarn build again each time.

  • Objective: Try to get a workflow where I can launch the speckle-server locally, test my scripts, and turn off the server and re-launch it later without any additional re-install steps. As bonus: it would be nice if I can also avoid the sign up process for locally adding and removing users and If I can do it in script.

  • Issue:
    I’m unable to get through the sign-up step locally. Before the new version I would be able to put in any random email/ username & password and I could go to localhost:1081 to find the 6 digit code then register. However with this latest 2.24.2 pull I’m unable to enter code page and simply get message saying unauthorized request. Even though a 6 digit code is generated for the request in localhost:1081

  1. I’ve tried launching the server with everything using yarn-dev in the main repo. Then try to sign up at localhost:3000

  2. Launching the server and frontend-2 package separately. (Front end being at localhost:8081). Then trying sign up.

  3. Clean installation from scratch.

Hi @Leul_Tesfaye

If you are testing against the running API, and not actually changing the code of speckle-server itself I would recommend using the pre-built Docker images which can be deployed with Docker compose. There are instructions in our documentation for this.

If you do need to amend the speckle-server source code, and wish to get the local development environment working - please share the exact commands that you are running, and any error log messages you get from your browser’s console, the frontend-2 logs, or the server logs. Please note that it will not run on Windows, and requires a posix (WSL, Mac or Linux) OS.

Iain

2 Likes

Hey Iain,

Thank you for your prompt response! I am currently only modifying the frontend-2 to add custom analysis results display functionalities to my workflow, so I need to build this instance running locally.

Here are specs of system I’m working on:

  • Windows 11 Home
  • Ubuntu 22.04 running in WSL2:
    • I’ve installed Mise, Docker,Docker Compose

Here are the installation and launch steps I have followed:

Not sure if it’s relevant but I’ve opted to ignore setting node.js to 18 since the latest 2.24.2 contains a mise.toml that defaults it node 22.

  1. I download the repo into Ubuntu subsystem
  2. cd Speckle-server
  3. corepack enable
  4. yarn
  5. yarn build
  6. yarn dev:docker:up
  7. cp packages/server/.env.example packages/server/.env
  8. cp packages/server/.env.test-example packages/server/.env.test
  9. cp packages/frontend-2/.env.example packages/frontend-2/.env
  10. cp packages/dui3/.env.example packages/dui3/.env
  11. For launching, I’ve tried just yarn dev in speckle-server directory
    • & yarn dev in packages/frontend-2 and packages/server into separate terminals

Following the install & launch steps above I’m able to get to login/signup page no problem. When I go to sign up, since this is a new server install, it takes me to the email, name, password page & hangs there with the following errors:

  • Pop up error:
    Registration failed Authentication request unexpectedly did not redirect

  • Console error:

auth.ts:105  POST http://127.0.0.1:3000/auth/local/register?challenge=yaf56qau74 400 (Bad Request)

Main Questions

  1. Is there something I’m doing wrong with local setup I need to fix? if not then how can I work around this account setup step in code?

  2. With either local server launch strategy (listed in 11), what are the steps for stopping the server and re-launching later (without having to do steps 5-11 of the install steps again)?

  • Currently I’m unable to simply exit with Ctrl+Z and relaunch it again without getting an error with one of the servers failing to launch.

Thanks for confirming this @Leul_Tesfaye , it generally looks correct. To answer your questions:

  1. The browser console error suggests it was sending a POST request to the server component. Are there any relevant logs in the server terminal to explain the 400 response?

  2. & 3.: To stop any application, you should use ctrl+c in the terminal. ctrl+z will move the process in to the terminal’s ‘background’ and not send any termination signal to the application, so it won’t actually stop. After using ctrl+c to terminate the application, you should then restart with step 11.

    If you change a package that is shared between components, such as packages/tailwind or packages/shared, you may have to run yarn build:public before yarn dev.

Iain

1 Like

Awesome I’ll just tested out ctrl+c and relaunch it seems to be working.

Here what shows up in the server terminal everytime I click signup:

This is on Microsoft Edge:

[@speckle/server]: [server] INFO: /auth/local/register request completed in 0 ms {"req":{"id":"766b9468-a95f-4cec-836d-909b4f491844","method":"OPTIONS","path":"/auth/local/register","pathParameters":{"challenge":"yaf56qau74"},"headers":{"host":"127.0.0.1:3000","connection":"keep-alive","accept":"*/*","access-control-request-method":"POST","access-control-request-headers":"content-type","origin":"http://localhost:3000","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0","sec-fetch-mode":"cors","sec-fetch-site":"cross-site","sec-fetch-dest":"empty","referer":"http://localhost:3000/","accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-US,en;q=0.9","x-request-id":"766b9468-a95f-4cec-836d-909b4f491844"}},"res":{"statusCode":204,"headers":{"x-request-id":"766b9468-a95f-4cec-836d-909b4f491844","access-control-allow-origin":"*","access-control-allow-methods":"GET,HEAD,PUT,PATCH,POST,DELETE","vary":"Access-Control-Request-Headers","access-control-allow-headers":"content-type","content-length":"0"}},"responseTime":0,"requestStatus":"completed","requestPath":"/auth/local/register"}
[@speckle/server]: [server] INFO: /auth/local/register request received {"req":{"id":"228dc788-3a0b-4d9d-b4c5-a0e80e12c64d","method":"POST","path":"/auth/local/register","pathParameters":{"challenge":"yaf56qau74"},"headers":{"host":"127.0.0.1:3000","connection":"keep-alive","content-length":"91","sec-ch-ua-platform":"\"Windows\"","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0","sec-ch-ua":"\"Chromium\";v=\"136\", \"Microsoft Edge\";v=\"136\", \"Not.A/Brand\";v=\"99\"","content-type":"application/json","sec-ch-ua-mobile":"?0","accept":"*/*","origin":"http://localhost:3000","sec-fetch-site":"cross-site","sec-fetch-mode":"cors","sec-fetch-dest":"empty","referer":"http://localhost:3000/","accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-US,en;q=0.9","x-request-id":"228dc788-3a0b-4d9d-b4c5-a0e80e12c64d"}},"requestPath":"/auth/local/register"}
[@speckle/server]: [server] INFO: /auth/local/register request completed in 52 ms {"req":{"id":"228dc788-3a0b-4d9d-b4c5-a0e80e12c64d","method":"POST","path":"/auth/local/register","pathParameters":{"challenge":"yaf56qau74"},"headers":{"host":"127.0.0.1:3000","connection":"keep-alive","content-length":"91","sec-ch-ua-platform":"\"Windows\"","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0","sec-ch-ua":"\"Chromium\";v=\"136\", \"Microsoft Edge\";v=\"136\", \"Not.A/Brand\";v=\"99\"","content-type":"application/json","sec-ch-ua-mobile":"?0","accept":"*/*","origin":"http://localhost:3000","sec-fetch-site":"cross-site","sec-fetch-mode":"cors","sec-fetch-dest":"empty","referer":"http://localhost:3000/","accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-US,en;q=0.9","x-request-id":"228dc788-3a0b-4d9d-b4c5-a0e80e12c64d"}},"res":{"statusCode":400,"headers":{"x-request-id":"228dc788-3a0b-4d9d-b4c5-a0e80e12c64d","access-control-allow-origin":"*","x-ratelimit-remaining":499,"content-security-policy":"frame-ancestors 'none'","content-type":"application/json; charset=utf-8","content-length":"479","etag":"W/\"1df-C+4wqJcnA5GaJIkABfRvS792d8s\""}},"responseTime":52,"requestStatus":"completed","requestPath":"/auth/local/register"}

On chrome I’m not even able to press the sign up button it just appears grayed out regarless of typing the same sign up information as I did in edge.