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.

A couple of bugs I faced today (`dev`, `publish`)

See original GitHub issue

Today on my personal laptop, I used wrangler and faced some issues. If necessary I’ll file separate issues for each of these problems, but just filing these right now while the details are still fresh -

  • I made a file index.ts with contents
    export default {
      fetch() {
        return new Response("hello world");
      },
    };
    
    and ran npx wrangler@beta dev index.ts on it. It returned -
    No account id found, quitting...
    
    I think this means that both the oauth_code and refresh_code were invalid. In such a scenario, we should popup the login flow again. I manually ran npx wrangler@beta login and ‘fixed’ this issue.
  • I then tried to publish it with npx wrangler publish index.js --name devto --latest (and I didn’t have a script named devto already published). It did nothing for a long time (say, 20 seconds), and then this error got logged
    Cannot read properties of undefined (reading 'forEach')
    
    I think this is pointing to this line of code https://github.com/cloudflare/wrangler2/blob/b63efe60646c8c955f4df4f2ce1d87ce9cc84ba3/packages/wrangler/src/cfetch/index.ts#L93
    • We should include stacks in our errors here https://github.com/cloudflare/wrangler2/blob/a5537f147e61b046e141e06d1864ffa62e1f2673/packages/wrangler/src/index.tsx#L2034-L2045 (logging e.stack instead of e.message). If we think these are noisy, then we should handle expected errors properly, and exit with process.exit(1) instead of throwing.
    • It looks like there are failure modes for api calls we haven’t considered. Specifically, it’s possible for the api to not follow the api schema (which, makes sense, networks suck). We should be more defensive in how we handle data structures off the network (In this case, testing whether messages exists on the response)
    • running the command again published the worker successfully.
  • When running dev, using the hotkey l to toggle between edge - local - edge logged this error
    17:48:12 Error: listen EADDRINUSE: address already in use :::8787
      at Server.setupListenHandle [as _listen2] (node:net:1334:16)
      at listenInCluster (node:net:1382:12)
      at Server.listen (node:net:1469:7)
      ...
    
    This means that we’re not shutting down the miniflare server cleanly, or maybe we’re trying to startup the remote proxy too soon after switching (before the miniflare server has closed).

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
threepointonecommented, Apr 1, 2022

This should be in a better place now. We still need to handle error messages better and present them in a better manner, tracking that in https://github.com/cloudflare/wrangler2/issues/377. Closing this issue. @tanguyantoine let us know if you face the issue again, thank you!

0reactions
tanguyantoinecommented, Apr 21, 2022

Sorry I switched back on something else, I might give it another shot later

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers — Take Bug Reports As Opportunities, Not ...
I recently released a major update to a web application I work on. The update included numerous new features as well as upgrades...
Read more >
What should be done after a bug is found (Bug Defect ...
Reporting bug immediately will help to write a good bug report, which help developer to get an exact idea of the problem faced...
Read more >
5 Common Bugs Faced in UI Testing - BrowserStack
Read this article by BrowserStack to understand the most commonly encountered UI bugs by the QAs while performing tests for UI and UX....
Read more >
How to answer interview question “You find a major bug, but ...
You find a major bug, but no developers are present. The release deadline is today. What do you do? It's not a difficult...
Read more >
A day in the life: how a frontend developer solves a "simple" bug
The Bug. I had implemented a new report page for one of our applications, where the user can create a spreadsheet like report...
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