Azure-Samples / contoso-real-estate

Intelligent enterprise-grade reference architecture for JavaScript, featuring OpenAI integration, Azure Developer CLI template and Playwright tests.
MIT License
858 stars 512 forks source link

[Chore] Unable to run app using Codespaces Instructions #449

Open DanWahlin opened 6 months ago

DanWahlin commented 6 months ago

Are you accessing the project from the GitHub Codespaces?

Describe the bug

Not all of the servers start. I'm seeing this in the logs after running npm install && npm start in the codespace:

[services] postgres_setup-1  | PostgreSQL Database restored successfully
[services] postgres_setup-1 exited with code 0
[services] blog-1            | TypeError: fetch failed
[services] blog-1            |     at Object.fetch (node:internal/deps/undici/undici:11731:11)
[services] blog-1            |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[services] blog-1            |   cause: Error: getaddrinfo ENOTFOUND blog-cms
[services] blog-1            |       at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
[services] blog-1            |       at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:128:17) {
[services] blog-1            |     errno: -3008,
[services] blog-1            |     code: 'ENOTFOUND',
[services] blog-1            |     syscall: 'getaddrinfo',
[services] blog-1            |     hostname: 'blog-cms'
[services] blog-1            |   }
[services] blog-1            | }
[services] blog-1            | [Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
[services] blog-1            |   digest: '2178396693'
[services] blog-1            | }
[services] blog-1            | TypeError: fetch failed
[services] blog-1            |     at Object.fetch (node:internal/deps/undici/undici:11731:11)
[services] blog-1            |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[services] blog-1            |   cause: Error: getaddrinfo ENOTFOUND blog-cms
[services] blog-1            |       at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
[services] blog-1            |       at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:128:17) {
[services] blog-1            |     errno: -3008,
[services] blog-1            |     code: 'ENOTFOUND',
[services] blog-1            |     syscall: 'getaddrinfo',
[services] blog-1            |     hostname: 'blog-cms'
[services] blog-1            |   }
[services] blog-1            | }
[services] blog-1            | [Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
[services] blog-1            |   digest: '2178396693'
[services] blog-1            | }
[services] blog-1            | TypeError: fetch failed
[services] blog-1            |     at Object.fetch (node:internal/deps/undici/undici:11731:11)
[services] blog-1            |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[services] blog-1            |   cause: Error: getaddrinfo ENOTFOUND blog-cms
[services] blog-1            |       at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
[services] blog-1            |       at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:128:17) {
[services] blog-1            |     errno: -3008,
[services] blog-1            |     code: 'ENOTFOUND',
[services] blog-1            |     syscall: 'getaddrinfo',
[services] blog-1            |     hostname: 'blog-cms'
[services] blog-1            |   }
[services] blog-1            | }
[services] blog-1            | [Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
[services] blog-1            |   digest: '2178396693'
[services] blog-1            | }

To Reproduce Steps to reproduce the behavior:

  1. Go to Codespace
  2. Type in command npm install && npm start
  3. View log errors

Expected behavior Expected all services to start

OS (please complete the following information):

juliamuiruri4 commented 5 months ago

Facing same issue, though this just affects the blog cms service

ZedFarNl commented 3 months ago

encounter the same issue in codespace

DanWahlin commented 3 months ago

Thanks for the information @ZedFarNl and sorry you’re hitting an issue here. Are you seeing the exact same error message as above or something different? If you can share the specific error that would be helpful.

//cc @manekinekko and @anfibiacreativa

anfibiacreativa commented 3 months ago

Thank you for reporting! We will be prioritizing this issue.

manekinekko commented 3 months ago

I've traced this issue and found the problem. It seems to be related to https://github.com/strapi/strapi/issues/12493 that prevents the CMS from starting, which explain why we are getting a 503. Since the Blog depends on the CMS, it's also impacted, hence the Error: getaddrinfo ENOTFOUND blog-cms error.

In the meantime, in order to unblock everyone, I've disabled this configuration in the Docker compose file untill the Strapi issue is fixed.

image image image

Note: the broken images in Blog are an expected result for now, because the db restore script contains image links that were hosted on Azure when the original db dump has been made. This can be improved in a separate PR if someone wants to take a shot and clean the db script.

manekinekko commented 3 months ago

Updates: I kept looking at this issue, and it seems that the CMS server fails to start randomly, I assuming this is because of some race condition issues when starting all containers at once. To fix this for now, please restart the CMS container and the server should start:

docker compose restart blog-cms