[solved] Dynamic import: Error: ENOENT: no such file or directory ... /dynamic/%3Canonymous%3E


I’ve started seeing some random errors in my production logs, trying to dynamic import an <anonymous> package:

Error: ENOENT: no such file or directory, open '/built_app/programs/web.browser/dynamic/%3Canonymous%3E'
    at Object.fs.openSync (fs.js:648:18)
    at fs.readFileSync (fs.js:553:33)
    at read (packages/dynamic-import.js:173:29)
    at walk (packages/dynamic-import.js:124:14)
    at Object.keys.forEach.name (packages/dynamic-import.js:131:22)
    at Array.forEach (<anonymous>)
    at walk (packages/dynamic-import.js:129:23)
    at readTree (packages/dynamic-import.js:152:10)
    at IncomingMessage.request.on (packages/dynamic-import.js:88:33)
    at emitNone (events.js:105:13)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1056:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

The errors come in groups of 3 in quick succession. I’ve never seen these errors in development or staging, and in production I’ve not been able to trigger them myself, after trying all routes. Nothing’s changed on my routes or dynamic importing recently either, so I’m not sure why it’s only started in the past week or so.

I’ve checked through all my import(...).then(....) calls and they look good. I’m using @manuel’s fantastic viewmodel which does some of it’s own lazy loading, but I’m not sure how that can be trying to load an <anonymous> file.

Any ideas? Or is there a way I can catch these errors in production and log which URL they’re coming from, or which user is logged in, etc?

Could it be a bot trying random fetches?

I’m using Meteor with mup on AWS, fully React.

Any thoughts greatly appreciated! Thanks.


Have you just switched to monti apm by any chance? We are just seeing the same kind of errors from dynamic-imports that never happened before after switching to monti, so maybe it is related.


This is from Monti APM looking for public source maps after receiving an error. I updated it to do a better job of recognizing dynamically imported files to help prevent the errors you are seeing in your logs.


Hi @zodern,
Is your fix released ? I’ll update our packages and see how it does.

ps - Great that you’ve taken on Kadira and are developing it a bit.


It was a change in the Monti APM server so you do not need to update anything. Please let me know if you see the errors again.


So far so good :+1: :+1: :+1:


Great, thanks @zodern for the quick fix. And thanks for MontiAPM!