Fix PVM compilation timeout and handle non-JSON error responses#39
Merged
Fix PVM compilation timeout and handle non-JSON error responses#39
Conversation
- Increase PVM worker timeout from 30s to 90s (resolc is significantly slower than solc, especially with OpenZeppelin transitive deps) - Keep EVM worker timeout at 30s (solc is fast) - Increase Vercel maxDuration from 60s to 120s for headroom - Add safe JSON parsing in both compileSolidity and compileSoliditySources — catches HTML 502/504 gateway timeout responses and returns a user-friendly error instead of crashing Fixes #38
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #39 +/- ##
==========================================
- Coverage 50.49% 50.42% -0.08%
==========================================
Files 178 178
Lines 22233 22266 +33
Branches 1236 1236
==========================================
Hits 11227 11227
- Misses 10958 10991 +33
Partials 48 48 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Reduce import resolution budget from 30s to 20s and PVM worker timeout from 90s to 80s. Worst case is now 20s + 80s = 100s, leaving 20s of headroom within the 120s maxDuration for cold start, request parsing, and response serialization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #38 — PVM compilation with OpenZeppelin imports times out on production.
Root cause: The worker timeout was 30s for both EVM and PVM. The resolc compiler (PVM) is significantly slower than solc (EVM), especially with transitive OpenZeppelin dependencies. Large contracts consistently exceed 30s.
Secondary issue: When the compilation times out and Vercel returns a 502/504 gateway timeout (HTML), the client crashes with
Unexpected token '<'because it callsres.json()on an HTML response.Changes
compileSolidity()andcompileSoliditySources()— catches HTML error responses and returns a clear error message instead of crashingTest plan
Unexpected token '<')yarn testpassesyarn buildpasses