TimeoutError: Error while deploying on google cloud run #384
-
YOUR BUG DESCRIPTION HERE If relevant, specify:
To ensure this bug gets triaged / prioritized quickly, please... While trying to use Google cloud run, there's a com.microsoft.playwright.TimeoutError thrown while navigating to "http://localhost:8080/admin/create?_kobwebIsExporting=true", waiting until "load" Use the default free cloud machine with ubuntu Following is my dockerfile Variables shared across multiple stages (they need to be explicitly optedinto each stage by being declaring there too, but their values need only bespecified once).ARG KOBWEB_APP_ROOT="site" FROM eclipse-temurin:17 as java FROM java as export #----------------------------------------------------------------------------- Create an intermediate stage which builds and exports our site. In thefinal stage, we'll only extract what we need from this stage, saving a lotof space.ENV KOBWEB_CLI_VERSION=0.9.13 ENV NODE_MAJOR=20 Copy the project code to an arbitrary subdir so we can install stuff in theDocker container root without worrying about clobbering project files.COPY . /project Update and install required OS packages to continueNote: Node install instructions from: https://github.com/nodesource/distributions#installation-instructionsNote: Playwright is a system for running browsers, and here we use it toinstall Chromium.RUN apt-get update Fetch the latest version of the Kobweb CLIRUN wget https://github.com/varabyte/kobweb-cli/releases/download/v${KOBWEB_CLI_VERSION}/kobweb-${KOBWEB_CLI_VERSION}.zip ENV PATH="/kobweb-${KOBWEB_CLI_VERSION}/bin:${PATH}" WORKDIR /project/${KOBWEB_APP_ROOT} Decrease Gradle memory usage to avoid OOM situations in tight environments(many free Cloud tiers only give you 512M of RAM). The following amountshould be more than enough to build and export our site.RUN mkdir ~/.gradle && RUN kobweb export --notty #----------------------------------------------------------------------------- Create the final stage, which contains just enough bits to run the Kobwebserver.FROM java as run ARG KOBWEB_APP_ROOT COPY --from=export /project/${KOBWEB_APP_ROOT}/.kobweb .kobweb ENTRYPOINT .kobweb/server/start.sh` The dockerfile works well on render.com |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 18 replies
-
Unfortunately, I'm not sure there is anything I can do in the Kobweb codebase. How many times have you tried redeploying? Personally I found working with Google Cloud Run (cheapest tier) very frustrating and temperamental and I often had to redeploy more than once to get something that stuck. |
Beta Was this translation helpful? Give feedback.
-
Tried it a lot of times using a tweaked docker and even the same one. When I tried deploying my container image via docker push it throws an error "site folder not found" |
Beta Was this translation helpful? Give feedback.
-
I often run Docker locally to verify that the image I wrote worked. Are you able to do that? That way we could verify the issue isn't the Dockerfile but is instead GCR somehow. (You said the file worked on render, though, right?) |
Beta Was this translation helpful? Give feedback.
-
Yes absolutely the same docker worked on render and locally as well. I have
the site folder too. Somehow gcr is doing something weird.
…On Fri, Nov 24, 2023, 03:52 David Herman ***@***.***> wrote:
site folder not found feels like a misconfigured Docker file? Basically
an earlier image should create a valid Kobweb site build and the last image
should copy over just those bits. Do you have a top-level site folder in
your project's root?
I often run Docker locally to verify that the image I wrote worked. Are
you able to do that? That way we could verify the issue isn't the
Dockerfile but is instead GCR somehow. (You said the file worked on render,
though, right?)
—
Reply to this email directly, view it on GitHub
<#382 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADXEZGSO6YJ3OT2XZHQKI3YF7EDVAVCNFSM6AAAAAA7WZO7J6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRUHE3DMNRWGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
That is so weird. Let me convert this issue to a discussion, so we can keep it going, because it doesn't feel right to close it. |
Beta Was this translation helpful? Give feedback.
-
Awesome, thanks a lot for the update
…On Tue, 28 Nov 2023 at 12:48, David Herman ***@***.***> wrote:
So I just ran an export locally and got this:
Snapshotting html for "/admin/login"...
Snapshot finished in 28811ms.
That's awfully close to the 30 second timeout being managed by playwright.
Give me some time to look into this tomorrow, it's my end of the day here.
Either something is happening that /admin/login is doing that should be
fixed. Alternately, maybe I should allow customizing the export timeout to
extend it.
—
Reply to this email directly, view it on GitHub
<#384 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADXEZFBVHT3YEQ4M6ELQV3YGWF4XAVCNFSM6AAAAAA74V55AKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TMOBYHEZDO>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I'm on mac, also trying to comment out login page entirely, will keep you
posted, I'm in +5:30 Timezone, India. Thanks
…On Tue, 28 Nov 2023 at 13:01, David Herman ***@***.***> wrote:
I have NO idea why the /admin/login page
<https://github.com/kairon007/BlogMultiplatformKmp/blob/master/site/src/jsMain/kotlin/com/example/blogmultiplatform/pages/admin/Login.kt>
would take ~30 seconds to export. Maybe I'm just too tired to see it right
now.
If you have time today (I'm not sure what your timezone is), you might try
disabling the page for now (just put a return at the top of the
composable), get things to export, and start introducing things back in
until you see what line is causing the huge performance spike.
I have a friend using Windows who isn't seeing the issue, while I myself
on Linux am, and the GitHub CI machine is also Linux. If you're a Windows
user, then that could be why things are working for you but not for the CI.
—
Reply to this email directly, view it on GitHub
<#384 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADXEZAK4MBOZWM6UWKWLD3YGWHLXAVCNFSM6AAAAAA74V55AKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TMOBZGAZDQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I'm still investigating this. However, I've got a workaround for you for now so you're not blocked. You'll need to set your Kobweb version to Fortunately, I've created a commit for Stevdza-san's upstream project that fixes them, which you can apply as well to your own project. Steps
I'll still update here when I figure out the root cause. However, this change is relatively non-hacky, and it should get you past your timeout issues. Let me know if this works for you or not! |
Beta Was this translation helpful? Give feedback.
-
OK, looks like I figured out the gist of what's going on, but I still don't understand the full details. You're calling API routes that are hanging for a while (e.g. "/api/readmainposts" and "/api/readmyposts"). I'm a bit confused about this because MongoDB APIs are themselves suspendable, but I'm guessing there's at least one call which is not, and is essentially locking up a thread on the server. I would put a bunch of logging in your At first, the client doesn't care that it doesn't get results from the server -- it just finishes the page without the returned data, takes a snapshot, and closes. However, the server is still trying hard to serve this value. This is going to be a problem soon, which is why you often felt like you would remove one page from the export only for another one to fail instead. The export process is basically visiting page after page without taking a break. So eventually you get to a new page that wants to ask the server for some resource (it doesn't have to be anything extremely complex; for example, I had it get stuck on serving me logo.svg before). The server tries to use a coroutine running on a thread to serve that resource, and it gets stuck, because that thread is still choking on the previous page's API request. My guess, not 100% sure, is that some part of MongoDB has a default timeout of 30 seconds, so after it fails to connect, it aborts some call, which in turn frees up the thread, which then finally serves the resource to the waiting page about 30 seconds later. If you go to On my end, I'm still investigating what I should be doing. For sure, I'm going to be adding the ability to create trace files when you export (which is a feature provided by Playwright and what I used locally to debug this). I should also probably have a way for the server to know it's in export mode, so maybe you can update your API routes to return / use a fake DB instance in that case. On your end, I'm not familiar enough to give confident advice, but perhaps one (or more) of:
I'll keep in touch as features land on my end. I think the idea of having a dummy database running on the server in export mode is the cleanest solution. |
Beta Was this translation helpful? Give feedback.
-
Still unable to do so getting
Users First seen Last seen
KobwebException: No site subfolders found. If you ran `kobweb export
--layout static`, you should run `kobweb run --env prod --layout static`
instead.
<https://console.cloud.google.com/errors/CLrXg-PZ1ZONkgE?time=P1D&service=blogmultiplatformkmp&authuser=1&hl=en&project=afineday-service-sms>
Also github pages also not showing the prod version just the static once I
used last time.
…On Wed, 29 Nov 2023 at 1:05 PM, David Herman ***@***.***> wrote:
Great! I think you should be able to run on GCR now?
—
Reply to this email directly, view it on GitHub
<#384 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADXEZHQQ5ZCHERKHAEQRNTYG3QS7AVCNFSM6AAAAAA74V55AKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TOMBRGA4DI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
No idea @kairon007 if you're still around or if you moved on after the frustrating experience with GCR, but we just released 0.15.3, which honestly was a bunch of changes inspired by your difficulties here. You may want to upgrade to that and see if things are better for you. We definitely fixed an issue with the whole export process dying if any of the individual exports timed out. You can review the release notes here: https://github.com/varabyte/kobweb/releases/tag/v0.15.3 |
Beta Was this translation helpful? Give feedback.
-
Thanks, I'll check it out!
…On Wed, 13 Dec 2023 at 4:17 AM, David Herman ***@***.***> wrote:
No idea @kairon007 <https://github.com/kairon007> if you're still around
or if you moved on after the frustrating experience with GCR, but we just
released 0.15.3, which honestly was a bunch of changes inspired by your
difficulties here. You may want to upgrade to that and see if things are
better for you. We definitely fixed an issue with the whole export process
dying if any of the individual exports timed out.
You can review the release notes here:
https://github.com/varabyte/kobweb/releases/tag/v0.15.3
—
Reply to this email directly, view it on GitHub
<#384 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADXEZATODJ772X5UC6B4M3YJDNHHAVCNFSM6AAAAAA74V55AKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TQMZWGEZDQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
No idea @kairon007 if you're still around or if you moved on after the frustrating experience with GCR, but we just released 0.15.3, which honestly was a bunch of changes inspired by your difficulties here. You may want to upgrade to that and see if things are better for you. We definitely fixed an issue with the whole export process dying if any of the individual exports timed out.
You can review the release notes here: https://github.com/varabyte/kobweb/releases/tag/v0.15.3