aleph.js icon indicating copy to clipboard operation
aleph.js copied to clipboard

Import map failing when running uninstalled using deno run ../start.ts

Open tiptenbrink opened this issue 4 years ago • 2 comments

When running Aleph.js in a Docker container and using a bash file with the start command as entrypoint, it no longer seems to correctly use import maps. I wanted to use Aleph.js uninstalled on the standard deno docker image and used the following command to start the server:

deno run -A https://deno.land/x/[email protected]/commands/start.ts . --port 8080

The server starts fine, but the import map does not work.

Here is the error:

I access the API: root@f12a79749f84:/opt/sd# curl localhost:8080/api/status/a (See on GitHub, the GitHub also contains the full project that this was tested on)

<!DOCTYPE html>
<title>Server Error</title>
<h1>Error: Relative import path "base64url" not prefixed with / or ./ or ../ from "file:///opt/sd/api/status/[server].ts"</h1>
<p><pre>TypeError: Relative import path "base64url" not prefixed with / or ./ or ../ from "file:///opt/sd/api/status/[server].ts"
    at async Aleph.getAPIRoute (https://deno.land/x/[email protected]/server/aleph.ts:486:29)
    at async Server.handle (https://deno.land/x/[email protected]/server/server.ts:240:23)
    at async https://deno.land/x/[email protected]/server/server.ts:382:15</pre></p>

It works fine if I just normally spin it up on my Linux machine or if I manually install Aleph on the container and then use aleph start.

tiptenbrink avatar Oct 07 '21 19:10 tiptenbrink

if you run your app by bootstrapping the start.ts, you need to pass the --import-map manually, pls use cli.ts start that will handle the import map automatically

ije avatar Oct 09 '21 12:10 ije

if you run your app by bootstrapping the start.ts, you need to pass the --import-map manually, pls use cli.ts start that will handle the import map automatically

Ah that makes sense. I just looked at the Deployment docs and assumed it would work the same. Maybe a good idea to add a caveat there that if using it like that you have to supply the import map manually?

tiptenbrink avatar Oct 09 '21 22:10 tiptenbrink