Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Cannot destructure property 'url' of 'nestedModules.pop(...)' as it is undefined. #218

@bergercookie

Description

@bergercookie

I have a file called user.ts under the api/ directory with the following contents:

import type { APIRequest } from "https://deno.land/x/aleph/types.ts";

export default function handler(req: APIRequest) {
  console.log(`req: `, req);
  console.log(`req.params: `, req.params);
  console.log(`req.params.action: `, req.params.action);
  req.status(200).json({ name: req.params.action});
}

I'm making an HTTP GET request to it using httpie

 http -v  localhost:8080/api/user action==all
GET /api/user?action=all HTTP/1.1 <--------------- Actual GET Request
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:8080
User-Agent: HTTPie/0.9.8



HTTP/1.1 500 Internal Server Error
cache-control: max-age=0
content-length: 209
content-type: text/html; charset=utf-8
date: Sun, 28 Mar 2021 09:05:39 GMT
server: Aleph.js

<!DOCTYPE html><title>500 - internal server error</title><p><strong><code>500</code></strong><small> - </small><span>Cannot destructure property 'url' of 'nestedModules.pop(...)' as it is undefined.</span></p>

Meanwhile, I can avoid getting a 500 error, only If I put this file under api/user/[name].ts, but in this case, it bundles the last part of the url along with the parameters after ?.

➜ http -v  localhost:8080/api/user/1 action==all

GET /api/user/1?action=all HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:8080
User-Agent: HTTPie/0.9.8

HTTP/1.1 200 OK
content-length: 11
content-type: application/json; charset=utf-8
date: Sun, 28 Mar 2021 09:17:26 GMT
server: Aleph.js

{
    "name": {}
}


# Server output:
DEBUG compile '/api/user/[name].ts' in 1ms
req:  Request {}
req.params:  { name: "1action=all" }
req.params.action:  undefined

I suppose this isn't the expected behavior. Is this a bug? Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✘ bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions