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.

🐛 BUG: wrangler2 can not decode `[` and `]`

See original GitHub issue

What version of Wrangler are you using?

2.0.16

What operating system are you using?

Mac

Describe the Bug

Description

When I serve my next app statically with wrangler pages dev out, I believe wrangler is failing to decode [id] and throwing me a 404 error. When I examine the network tab of the developer console, I see that the failing request is to %5Bid%5D. However the same request results with a 200 response on Cloudflare Pages. Also if I edit the failing GET request by replacing the %5B and %5D with [ and ], I get a 200 response. I believe there is something wrong with the decoding of [ and ]. image

Steps to Reproduce

  • Create a next app with yarn create next app pages-example
  • Add "export": "next export" to package.json
  • create a directory under /pages named p and create an empty [id].js file.
  • fill the file with the following content
    import React  from 'react';
    import { useRouter } from 'next/router';
    
    const Page = () => {
        const router = useRouter();
    
        const { id } = router.query;
    
        console.log(id, router);
        return (
      	  <div>
      		  id from url: { id } 
      	  </div>
        );
    };
    
    export default Page;
    
  • create a /functions/p/[id].js with the following content
    export function onRequestGet({ env, request, params }) {
      console.log("entering the function")
      console.log("env", env)
      console.log("request", request)
      return env.ASSETS.fetch(new Request(new URL('/p/[id]', request.url).toString(), request));
    }
    
    
  • run yarn build && yarn export
  • run wrangler pages dev out
  • type http://localhost:8788/p/12 to the address bar.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Skye-31commented, Aug 1, 2022

I’ll have a look into resolving that in the morning 🙂

1reaction
dgokcincommented, Jul 31, 2022

@Skye-31 I can test it tomorrow and let you know!

Read more comments on GitHub >

github_iconTop Results From Across the Web

BUG: Route of `*/*` can no longer be deployed with Wrangler ...
Mac and Linux Describe the Bug We have been using the pattern of: route = { pattern = "*/*", zone_name = "decode.do" }...
Read more >
Wrangler commands - Cloudflare Workers docs
Wrangler commands. Wrangler offers a number of commands to manage your Cloudflare Workers. docs - Open this page in your default browser.
Read more >
Cask Data Application Platform 发行说明
This release introduces a number of new features, improvements, and bug fixes to CDAP. Some of the main highlights of the release are:...
Read more >
Rita Kozlov - Noise
Not only is SQLite the most ubiquitous database in the world, used by billions ... and where there's code, well, bugs are also...
Read more >
homebrew-core - Homebrew Formulae
a2ps 4.14 Any‑to‑PostScript filter aacgain 1.8 AAC‑supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
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