How to print Replit dev URL programmatically?

Problem description:
I can no longer predict what the Replit Dev URL is going to be, making shared dev tools and sample projects more difficult to use.

Expected behavior:
Project_Directory.REPL_OWNER.repl.co === dev endpoint.

Actual behavior:
https://b2fddde6-8afb-4ef1-8382-a7566388df38-00-jf3pqbil5xdr.kirk.replit.dev/

An unpredictable URL with parts that are not possible to figure out based on ENV vars alone. And no API to fetch it.

Steps to reproduce:
Try to print the URL to console.
https://replit.com/@fossprime/Print-Endpoint-URL-Broken

This is big downgrade to dev experience for people who used tools that appended path info and tokens to the URL in the console.

3 Likes

This is intentional, it’s designed to make the URLs harder to share/remember. Also, they will change every so often.

Most of it is actually in env vars, except for a small segment in the middle of the URL.

3 Likes

These URLs change ~1 time per year, so you could copy the URL and put it into a Secret (which is what I do), but maybe there’s a better solution here :slight_smile:

6 Likes

What is the small segment in the middle of the URL?

Example URLs that I would really like working again:

  • Vite Remote URL console printout
  • Slidev domain.com/presenter/1 link
  • SSO server debugging links
  • Replit Multiport URLs… Running a client and a server on different ports now requires manual configuration… rendering Starter projects like Feather-chat a much bigger hassel.
  • NPM packages that integrate server packages with client-side packages… now require additional Replit specific manual configuration, when they used to be one-click
  • Countless other situations where code expects the server to know the remote endpoint
  • E2E testing with SSL dependent Web APIs

Also why are these so crazy long? It hurts DX for web developers… The primary reason to use Replit is hypothetically improved DX…

1 Like

Using your URL above:

REPL_ID

:person_shrugging: This is the part not in env vars

REPLIT_CLUSTER

That’s going off memory, there’s a topic about it here somewhere.

EDIT: Found the topic I was looking for:

2 Likes