Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Astro SSR application deployment failing #389

Open
1 of 6 tasks
LukeSchlangen opened this issue Mar 13, 2024 · 0 comments
Open
1 of 6 tasks

Astro SSR application deployment failing #389

LukeSchlangen opened this issue Mar 13, 2024 · 0 comments
Labels
kind/bug Something isn't working

Comments

@LukeSchlangen
Copy link
Member

Describe the bug

Astro Server-Side Rendered application does not successfully deploy after adding the Node.js adapter

Additional context

How are you using GCP buildpacks?

  • pack and the gcr.io/buildpacks/builder
  • Cloud Functions
  • Cloud Run
  • Cloud Build
  • App Engine Standard
  • App Engine Flex

Did this used to work?

No

What language is your project primarily written in?

Node.js

Steps To Reproduce

Steps to reproduce the behavior:

  1. npm create astro@latest astro-app
  2. cd astro-app
  3. npx astro add node
  4. gcloud run deploy --allow-unauthenticated

Expected behavior

Successfully deployed application, which I am able to get if I follow these steps:

  1. npm create astro@latest astro-app
  2. cd astro-app
  3. npx astro add node
  4. npm pkg set scripts.start="HOST=0.0.0.0 node ./dist/server/entry.mjs"
  5. gcloud run deploy --allow-unauthenticated

Actual behavior

Successful build. Failed deployment to Cloud Run.

Possible fix

  1. Detect Astro for node is enabled by checking if @astrojs/node exists in dependencies in package.json
  2. Confirm the start script is equal to astro dev which starts the development server. If it's not the default, that means the developer has customized it, and we should go with that.
  3. Set the start script to HOST=0.0.0.0 node ./dist/server/entry.mjs. Without HOST=0.0.0.0 the application will try to serve on localhost and that seems to fail on Cloud Run.

Potential reasons to Close as Won't fix

  • Since the command npx astro add node is still required, it might not truly be considered an "out of the box" deployment
  • Setting the HOST environment variable within Cloud Run is something we haven't done to deploy other frameworks and could be further than we would like to go in order to support Astro deployments
@LukeSchlangen LukeSchlangen added the kind/bug Something isn't working label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant