Solved

No "Console.logs()" are output - Remix Template

Konnivenz
Shopify Partner
6 0 0

Hey,

 

No matter where I place my own Console.log(), no logs are output with the remix template. I have also set the logger to debug. I started locally with npm run dev. 

 

I have looked at so many things. But I just can't find a solution. My packages are the latest ones:

  • Package versions:

"@remix-run/dev": "^2.7.1",
"@remix-run/node": "^2.7.1",
"@remix-run/react": "^2.7.1",
"@remix-run/serve": "^2.7.1",
"@shopify/app": "3.57.0",
"@shopify/cli": "3.57.0",
"@shopify/polaris": "^12.0.0",
"@shopify/shopify-api": "^9.2.0",
"@shopify/shopify-app-remix": "^2.5.0",

  • Node version: v18.12.0
  • Operating system: MacOS 14.0

 

Does anyone have any idea what the problem is?

 

Thank you 🙂

Accepted Solution (1)
Crowly
Shopify Partner
65 3 5

This is an accepted solution.

Are you ensuring something is being submitted to your action function? Have you tried logging in the loader function?

Convert more customers with AI-powered, automated conversion rate optimization.
️ Free plan now available!
https://apps.shopify.com/crowly

View solution in original post

Replies 5 (5)

Crowly
Shopify Partner
65 3 5

Make sure you take a look at where your console.log code is. If its placed on the frontend, it will be logging to the browser/client side. If its on the backend, it will be logging to your console in VS code or wherever you are running your code.

Convert more customers with AI-powered, automated conversion rate optimization.
️ Free plan now available!
https://apps.shopify.com/crowly
Konnivenz
Shopify Partner
6 0 0

Thanks for your reply. I also thought I was looking wrong. But if, for example, I add a console.log to app._index.ts within action in the remix template, it should be printed on the server side and thus in the terminal and not in the browser.

export const action = async ({ request }: ActionFunctionArgs) => {
  const { admin } = await authenticate.admin(request);
  console.log("test -----");

...
}


But unfortunately this does not happen. 

Konnivenz
Shopify Partner
6 0 0

I tried an other project from a YouTuber https://github.com/stefanoHTB/remix-youtube-tutorial. Because I thought I had done something wrong. But I think something about the new packages or cli no longer fits. The older packages in this projects work. And I can output everything via console.log.

 

Crowly
Shopify Partner
65 3 5

This is an accepted solution.

Are you ensuring something is being submitted to your action function? Have you tried logging in the loader function?

Convert more customers with AI-powered, automated conversion rate optimization.
️ Free plan now available!
https://apps.shopify.com/crowly
Konnivenz
Shopify Partner
6 0 0

You are totally right 🙄 I thought the above action would also be called at startup. Sometimes you're just in a programming tunnel! 

 

Well, I hope that helps someone else too.
Thank you!