question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

šŸš€ Feature Request: [Wrangler 2 Regression] Being able to inspect the worker code

See original GitHub issue

Describe the solution

Wrangler 1 was generating the worker code locally on my machine, and added the worker code to my source tree, so I could easily inspect it.

Wrangler 2 most likely also generates the worker code locally on my machine, but I canā€™t find where it then lives? Is it written to the filesystem somewhere? Being able to inspect the worker code is paramount for debugging.

I know I can inspect the worker code on couldflare.comā€™s UI but thatā€™s quite inconvenient.

(Btw. wrangler 2 is much better than wrangler 1, nice job šŸ‘Œ.)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
brilloutcommented, Jul 31, 2022

With beta itā€™s still off:

Error thrown while running $ wrangler dev:

Error: [telefunc@0.1.22][Wrong Usage] Using `telefunc()` (`import { telefunc } from 'telefunc'`) is forbidden on the client-side, see https://telefunc.com/isomorphic-import
    at worker.js:491:7
    at handleTelefunc (worker.js:497:32)
    at handleFetchEvent (worker.js:560:31)
7:47:02 AM POST /_telefunc 500

The worker code generated by $ wrangler publish --dry-run:

  494   async function handleFetchEvent(event) {                                                                                                                    
  495     const { url } = event.request;                                                                                                                            
  496     const { pathname } = new URL(url);                                                                                                                        
  497     if (pathname.startsWith("/_telefunc")) {                                                                                                                  
  498       const body = await event.request.text();                                                                                                                
  499       const { method } = event.request;                                                                                                                       
  500       const response2 = await handleTelefunc({ url, method, body });                                                                                          
  501       return response2;                                                                                                                                       
  502     }                                                                                                                                                         
  503     const response = await handleStaticAssets(event);                                                                                                         
  504     return response;                                                                                                                                          
  505   }    

Note how handleTelefunc() lives at line 500 which doesnā€™t match the stack trace.

using a custom build, you can skip wranglerā€™s bundling altogether with --no-bundle

Neat & I can confirm that works:

wrangler publish --dry-run --outdir worker-build 
wrangler dev --no-bundle worker-build/index.js 

I can start debugging now. And, yes, I think itā€™d be great to document this. This makes debugging 10x more fun.

(FYI Iā€™m debugging Telefuncā€™s Cloudflare support.)

Thanks! I guess we can close this then.

0reactions
threepointonecommented, Jul 30, 2022

Could you try with the @beta version? We landed a fix for error stacks that weā€™ll release next week. Alternately, if youā€™re using a custom build, you can skip wranglerā€™s bundling altogether with --no-bundle (in both dev and publish)

Read more comments on GitHub >

github_iconTop Results From Across the Web

a new developer experience for Cloudflare Workers - Noise
How does this work? Recently, we announced that Miniflare (created by Brendan Coll), a project to locally emulate Workers in Node. js, hasĀ ......
Read more >
YRS - River Thames Conditions
Soundcloud will not open, Aarhus university business school, Studio 2 st martins lane, ... Jdk8 features, Directed arp request, Swavelle textiles.
Read more >
Untitled
China wok columbia sc menu, 2 view kub, Index of refraction online ... Shunk pa zip code, Sat ii world history practice test...
Read more >
Untitled
Martin blankemeyer email, Archival print protectors, Schwannoma vestibular derecho, P0451 ford code, Psk importer maya, Actors 2013 male, Glera cervicalaĀ ...
Read more >
Available CRAN Packages By Date of Publication
2022-12-22, highr, Syntax Highlighting for R Source Code ... 2022-11-18, CORElearn, Classification, Regression and Feature Evaluation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found