You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: report startup errors before workerd profiling (#10169)
* fix: report startup errors before workerd profiling
- Report original startup error message before attempting profiling
- Handle workerd profiling failures gracefully
- Silent profiling failures for deployment errors, reported for manual profiling
- Ensure users see the actual startup error even if profiling fails
- Fixes#10133
Co-Authored-By: [email protected] <[email protected]>
* fix: correct error handling in handleStartupError to allow UserError propagation
- Restructure try-catch to only handle profiling failures, not intentional UserError
- Ensure tests receive expected UserError message
- Update PR description to fix validation requirements
Co-Authored-By: [email protected] <[email protected]>
* test: add comprehensive tests for handleStartupError function
- Test profiling success with profile information included
- Test silent profiling failures for deployment errors
- Test reported profiling failures for manual profiling
- Test relative path handling in profile output
- Test startup error reporting before profiling attempts
Co-Authored-By: [email protected] <[email protected]>
* refactor: show startup errors before profiling attempts
- Log startup error immediately before attempting profiling
- Eliminates duplicate error handling in catch block
- Maintains silent profiling failures for deployment errors
- Maintains reported profiling failures for manual profiling
- Cleaner error handling approach as requested
Co-Authored-By: [email protected] <[email protected]>
* fix: resolve Windows path separator issue in test
- Update test assertions to be platform-agnostic
- Check for key path components rather than exact separators
- Fixes Windows CI failure in 'uses relative paths for profile output' test
Co-Authored-By: [email protected] <[email protected]>
* rework the friendly validator processing
- moves `printOffendingDependencies()` to the friendly-validator-errors.ts file, which is the only place it is used
- changes the friendly-validator-errors.ts functions to just return error messages that can then be used as needed by client code
* fix: resolve TypeScript error and Windows path separator issue
- Fix Uint8Array generic type error in check/commands.ts
- Update normalizeMessage to handle cross-platform path separators
- Ensure test snapshots work on both Windows and Unix systems
Co-Authored-By: [email protected] <[email protected]>
* ensure that slashes are normalized before the startup profile hash
* reuse normalizeString helper
* catch all start-up-profile strings when normalizing
* fixup snapshot & normalization
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Peter Bacon Darwin <[email protected]>
makeStartupError("Script startup exceeded CPU limit."),
32
+
{},// no dependencies
33
+
newFormData(),// mock worker bundle
34
+
"/test"
35
+
)
36
+
).toMatchInlineSnapshot(`
37
+
"Your Worker failed validation because it exceeded startup limits.
38
+
39
+
Deploy failed
40
+
- Script startup exceeded CPU limit.
41
+
42
+
To ensure fast responses, there are constraints on Worker startup, such as how much CPU it can use, or how long it can take. Your Worker has hit one of these startup limits. Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.
43
+
44
+
Refer to https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time for more details"
45
+
`);
46
+
47
+
expect(std).toMatchInlineSnapshot(`
48
+
Object {
49
+
"debug": "An error occurred while trying to locally profile the Worker: Error: workerd profiling failed",
50
+
"err": "",
51
+
"info": "",
52
+
"out": "",
53
+
"warn": "",
54
+
}
55
+
`);
56
+
});
57
+
58
+
it("reports size errors even if bundle analysis would fail",async()=>{
"Your Worker failed validation because it exceeded startup limits.
103
+
104
+
Deploy failed
105
+
- Exceeded startup limits.
106
+
107
+
To ensure fast responses, there are constraints on Worker startup, such as how much CPU it can use, or how long it can take. Your Worker has hit one of these startup limits. Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.
108
+
109
+
Refer to https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time for more details
110
+
A CPU Profile of your Worker's startup phase has been written to .wrangler/tmp/startup-profile-<HASH>/worker.cpuprofile - load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph."
0 commit comments