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

refactor(eas-cli): allow Expo Router server deployments without client directory #2597

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

byCedric
Copy link
Member

Why

Previously, we checked on the existence of both /dist/client and /dist/server to enable a deployment for API routes. With upcoming changes in Expo Router, we'd need to support a "server only" deployment. This means, we can't check /dist/client as it might not exist.

How

  • Check on /dist/server/_expo/routes.json to enable server deployments
  • Make /dist/client optional during upload

Test Plan

  • $ bun create expo ./test-server-only
  • $ cd ./test-server-only
  • Create an API route, e.g. app/test+api.ts with:
    export function GET() {
      return Response.json({ ok: true });
    }
  • Change the output type to server in app.json's web.output = server.
  • $ rm -rf ./dist/client
  • $ easd deploy

@byCedric byCedric force-pushed the @bycedric/worker/detect-expo-router branch from 32ed47b to 100ef2f Compare September 24, 2024 15:12
Copy link

✅ Thank you for adding the changelog entry!

Copy link

Size Change: -501 B (0%)

Total Size: 52.9 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 52.9 MB -501 B (0%)

compressed-size-action

Copy link

codecov bot commented Sep 24, 2024

Codecov Report

Attention: Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.

Project coverage is 51.99%. Comparing base (c0c2755) to head (88e12d3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/eas-cli/src/commands/worker/deploy.ts 0.00% 5 Missing and 3 partials ⚠️
packages/eas-cli/src/worker/assets.ts 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2597      +/-   ##
==========================================
- Coverage   52.00%   51.99%   -0.01%     
==========================================
  Files         562      562              
  Lines       21194    21199       +5     
  Branches     4335     4338       +3     
==========================================
  Hits        11020    11020              
- Misses       9292     9294       +2     
- Partials      882      885       +3     
Flag Coverage Δ
51.99% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@byCedric
Copy link
Member Author

byCedric commented Sep 24, 2024

@kitten the "wait until the deployment is ready before responding that the deployment is ready"-thing broke again with this change 🙈

When there is no /dist/client dir, we skip uploading assets. Because of that, the promote to prod is hitting faster than the server actually stores in the DB. What do you think is the best option here?

  • Let the server process the thing before responding
  • Retry the promote if there is a 404 in the CLI

image

Copy link
Member

@kitten kitten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving since implementation itself is fine.

Re. the timing issue, this ticket would resolve these problems for sure: https://linear.app/expo/issue/ENG-13544/implement-closing-request-for-upload-logic

But weirdly enough, I can't spot any deferred logic in here that would otherwise cause this. So, not sure why this timing issue is happening

@byCedric
Copy link
Member Author

The mystery has been solved by @kitten, it's pending merge & deploy. Going to merge this PR as is; the erroneous case should be fixed by the pending PR.

@byCedric byCedric merged commit f5df6e6 into main Sep 24, 2024
9 checks passed
@byCedric byCedric deleted the @bycedric/worker/detect-expo-router branch September 24, 2024 18:03
khamilowicz pushed a commit that referenced this pull request Sep 27, 2024
…t directory (#2597)

* refactor(eas-cli): allow Expo Router server deployments without client directories

* docs: fix changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants