How do I check the remix logs of my Glitch project?

I want to check the remix logs of my site, Glitch :・゚✧. How can I do so? :thinking:

1 Like

You can run the following to see where your project originated from in the logs tab:

console.log(process.env.PROJECT_REMIX_CHAIN)

// ["a0fcd798-9ddf-42e5-8205-17158d4bf5bb","c62efef6-1e75-45cf-b248-afeccdda9477"]
// returns ids

I know this isn’t a great answer, but this is the best way to find out at the moment.

1 Like

Will that actually show a list of ID’s in a React or Node app? Because I tried to do a quick and dirty version in a regular HTML file with a script and dotenv cdn and it tells me require and process.env are not defined. lol. It needs to be secured anyway…

EDIT: I tried it with import.meta.env.PROJECT_REMIX_CHAIN in a Vite/React project and no dice. Can kinda see why but I thought it might just work…oh well.

1 Like

Hi, in a Vite/React app if you try importing loadEnv in vite.config.js you should hopefully be able to get the remix chain, like this extending the code in the Glitch Hello React app:

import { defineConfig, loadEnv } from "vite";

console.log(process.env.PROJECT_REMIX_CHAIN);
1 Like

Thanks, I added the loadEnv and I still get process not defined, in the terminal, console, and within the app. Does it have to be connected with an API? Because I have a React Covid tracker, which I’m using an example, and that one has a few working APIs hooked up using Fetch and an .env file. The import.meta stuff is in an X-App-Token header, though. This is the project - https://react-covid-19-tracker.glitch.me.

I’ve had a similar issue with Vite before. Maybe node-fetch would be better for this, within a Node app.

1 Like

So hopefully this is reproducible lol but I remixed your project, removed the PROJECT_REMIX_CHAIN var that you have declared in the .env, refreshed and it seemed to work - maybe having it explicitly declared was overwriting the default one…?

1 Like

That’s odd because I added that to the .env file later on. Maybe it just needed a refresh?

How did you console.log it? Did you do that in the terminal or in the browser?

EDIT: Maybe there just aren’t any remixes so it doesn’t create a log for me.

1 Like

Here it is: remix

It shows in the Glitch log like this:

2 Likes

Oh cool! It does work for me right in the config file like that. Thanks! I was trying to display the data on a page or by console.logging in the browser. Is that info somehow restricted to being shown in the Glitch logs?

2 Likes

NP! Yep so I think that’s down to how the site is built when it’s Vite/React, like it’s accessible to the build process so you’d need to explicitly pass it to the front-end…?

2 Likes

For Vite apps I know they want every .env to start with VITE_ so that might be why it’s not showing, outside of the logs. With a Node app it shouldn’t matter.

1 Like

I’m gonna play around with all this more later today. Thanks for all your help and insight!

2 Likes

so what is the easiest way to check my remix logs on https://vhe.glitch.me? (my glitch project)

my app is running on node

Hey, I tried adding some code to your app, let me know if you can see any remix logs after you login. The login didn’t work for me.

EDIT: your project is newly created so you may not have remixes yet. If I do a console.log in the server.js file, it doesn’t show anything but I don’t get an error either. More specifically: I’ve added the dotenv package, and some JS code to the head of your index.html file, plus a div for displaying. If you remix the project or apply it to another Node app, hopefully you will see logs.

Just to clarify, as @RiversideRocks mentioned, the remix chain is the chain of projects leading up to yours vs projects remixed from yours…

1 Like

That’s useful thanks! I got confused lol.

I got the chain showing in my Glitch logs on this Node app. See the server.js file. But on the front end, I get process not defined, not quite sure why.

would you be able to set it up on my app Glitch :・゚✧, or did you already do that?

I did - see your server.js file. I don’t see anything in your logs though. You have a lot of other code in there, probably why.

i think i tested it on another project, it gave me some unrelated links though. How do I restart my app?