Development discussions around Shopify APIs
Hello. Recently I've been exploring deployment options for the base node/react app generated by the Shopify CLI and I've noticed something odd:
No matter which option I choose for deployment (Heroku, Google App Engine, and Google Cloud Run are the three I've tested), the initial load time is extremely high (typically between 11 and 21 seconds!). Subsequent load times are much more reasonable, anywhere from a few hundred milliseconds, to 2 seconds on the slow side.
Through my research I've discovered that part of the problem is "Cold Boot Times" for the different deployment options listed above. This makes some sense of course, since the hosting server needs to spin up an instance to serve the initial request. However the added startup time due to the cold boot of an initial instance doesn't appear to be the only problem here, since deploying a similar next/koa app without the shopify-api (v1.2.1) and koa-shopify-auth (v4.1.2) modules produces cold boot times that are between 1 and 3 seconds.
This issue is quite a large one, as apps are rejected during the review process for slow load times, a reasonable cause for rejection to be sure. However, it seems as though the Shopify provided example app wouldn't pass the shopify review process either.
My questions are:
Thank you all for your help!
It sounds like the development version is being deployed, which includes just-in-time compilation of assets, etc. You'll need to build a production version
$ npm run build # which runs `next build`
then run/deploy the application using
$ npm run start # which runs `NODE_ENV=production node server.js`
@mkevinosullivan, thank you so much for the prompt reply. Unfortunately, this is not the case.
Specifically in App Engine (my preferred hosting solution at the moment) the deployment knows to start the app using the specified script in package.json:
"start": "cross-env NODE_ENV=production node ./server/index.js"
Do you have any other suggestions for this issue?
Thank you again!
Is anyone else experiencing this issue?
Hi Jonathan, I have the same problem, did you manage to solve it?
Experiencing same issue. How it is possible that official sample is so bad???
As a business owner, have you ever wondered when your customer's first impression of yo...By Skye Jun 6, 2023
We're excited to announce improvements to the threaded messaging experience in our communi...By TyW May 31, 2023
Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...By Jacqui May 30, 2023