Questions and discussions about using the Shopify CLI and Shopify-built libraries.
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:
"@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",
Does anyone have any idea what the problem is?
Thank you 🙂
Solved! Go to the solution
This is an accepted solution.
Are you ensuring something is being submitted to your action function? Have you tried logging in the loader function?
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.
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.
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.
This is an accepted solution.
Are you ensuring something is being submitted to your action function? Have you tried logging in the loader function?
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!