Skip to content

Plain .js files not working: Script did not add a fetch listener #49

@betamint

Description

@betamint

With the following test.js, denoflare won't start.

% cat test.js
export default {
    async fetch (request, env) {
	return new Response ('hello\n');
    },
};
% ../bin/denoflare serve test.js
Compiling https://raw.githubusercontent.com/skymethod/denoflare/v0.5.11/cli-webworker/worker.ts into worker contents...
✅ Granted write access to "/var/folders/dl/2c03sbp56t3djlcsq246h9v80000gn/T/".
Bundled https://raw.githubusercontent.com/skymethod/denoflare/v0.5.11/cli-webworker/worker.ts (process) in 1219ms
runScript: test.js
worker: start
Error running script Error: Script did not add a fetch listener
    at Function.create (blob:null/13008441-80e2-4428-9ef9-bead231069a1:614:48)
    at async Function.start (blob:null/13008441-80e2-4428-9ef9-bead231069a1:679:125)
    at async blob:null/13008441-80e2-4428-9ef9-bead231069a1:2781:22
    at async RpcChannel.receiveMessage (blob:null/13008441-80e2-4428-9ef9-bead231069a1:39:36)
    at async self.onmessage (blob:null/13008441-80e2-4428-9ef9-bead231069a1:2810:13)

.ts files works fire, however. Seems plain .js files are not supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions