-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error using miniflare -w
; FetchError: No fetch handler
after rebuild
#34
Comments
Hello! 👋 I think the issue here is the You should be able to fix this by removing the |
Just released version |
Hmm, I'm still running into this issue on Windows with 1.4.1 (but not macos, where it works as expected). I run webpack and miniflare together with {
"server-webpack": "webpack -w --config webpack.server.config.js",
"server-miniflare": "miniflare --kv=STORE --watch --debug server/devdist/worker.js"
} After any code change, all requests throw I don't thiink I'm removing devdist at any point, unless webpack does that by default somehow. Ideally, I would prefer miniflare not to handle the build part and instead just watch the output, because it's faster DX to run webpack watch separately than to have miniflare reinvoke a webpack build from scratch each time (due to the startup overhead). I think the problem might be that it reloads worker.js when webpack starts writing to it, instead of when it finishes? The log looks like this:
|
Fixes some cases of cloudflare#34 where miniflare reloads the worker js file as it is being written to (e.g. by webpack), rather than when it has finished emitting. Seems to particularly be a problem on Windows.
I've put in a pull request to fix this (at least for my particular scenario, hopefully also others) by using chokidar's awaitWriteFinish option to check that the file isn't actively in the process of being altered before reloading it. |
Hey @Kostanos! It looks like you've got the |
Actually I'm using the "module" type, here is a small shot of my code. // eslint-disable-next-line import/no-unresolved
import { verifyIdToken } from 'web-auth-library/google';
import { v4 as uuidv4 } from 'uuid';
import { parseToken } from './helpers';
export default {
/**
*
* @param {import("@cloudflare/workers-types/experimental").Request} request
* @param {object} env
* @param {import("@cloudflare/workers-types/experimental").ExecutionContext} _ctx
* @returns {Promise<Response>}
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async fetch(request, env, _ctx) {
// Only accept a PUT request
if (request.method !== 'PUT') {
return new Response('{"error": "Bad request!"}');
}
let envCheck;
if (!((envCheck = 'GOOGLE_CLOUD_CREDENTIALS') in env)) throw new Error(`Missing ${envCheck} environment variable`);
if (!((envCheck = 'AUTH_KEY_SECRET') in env)) throw new Error(`Missing ${envCheck} environment variable`);
if (!((envCheck = 'R2_BUCKET') in env)) throw new Error(`Missing ${envCheck} environment variable`);
try {
const idToken = parseToken(request);
... BTW. I decided to give up with cloudflare server-less for the moment and will implement the traditional micro-services architecture with nodejs. I spent 3-4 days to make the following stack work together:
and I failed. I've tried both, With micro-services I can make it work in one day. Thank you for your help anyway. |
Any news on this? I'm facing the same issue as @Kostanos:
And I'm also getting |
Hello - I'm struggling with the same issue when running I'm using wrangler 3.0.0 and am trying to make the module syntax work. The When I use I would say we should reopen this thread. |
I am on Windows. While stumbling my way to the error in #33 I also encountered this issue with Miniflare failing on rebuild with the watcher. I am including logs that demonstrate starting my worker with
miniflare -w
, making a request to my worker which failed due to #33, then removing the problematic caching code. At this point the worker is rebuilt automatically. The call should succeed now. When I make another request to my worker, the call fails withFetchError: No fetch handler responded and unable to proxy request to upstream: no upstream specified
. When I terminate Miniflare and restart it, the same call will succeed as expected. Here are my logs:The text was updated successfully, but these errors were encountered: