nestdotland / nest.land

🦕 The Nest Website
https://nest.land
MIT License
371 stars 19 forks source link

Bug: importing from x.nest.land results in empty response #319

Closed TillaTheHun0 closed 3 years ago

TillaTheHun0 commented 3 years ago

Thanks for nest.land! It's been a boon for our software delivery.

Problem

On a few occasions, after publishing a new module version to nest.land, i've tried to import a module and x.nest.land seems to return an empty response. This causes an error when I trying to access, say, the default export.

deps.js

export { default as elasticsearch } from "https://x.nest.land/hyper-adapter-elasticsearch@0.1.5/mod.js";

the error produced is what you would expect from an empty response:

Uncaught SyntaxError: The requested module 'https://x.nest.land/hyper-adapter-elasticsearch@0.1.5/mod.js' does not provide an export named 'default'

Though if you GET that URL now, you can see this module does indeed have a default export.

Investigation

This seems to only happen, within a short time window, after publishing a module.

I notice, on the web app, that while I receive this blank response, no dependencies are listed in the side panel, even though this package does have some.

I expect the normal behavior of a 302 redirect to arweave, but this doesn't happen within the time window. Usually after a couple minutes, x.nest.land does 302 to arweave, and dependencies show up in the web app. My suspicion, and this could be way off, is that there is some sort of processing for the dependencies of the module before the redirect rule to arweave is added.

Don't know how much that info helps, but figured i'd add it. Thanks again!

maximousblk commented 3 years ago

This is a known issue.

When you publish a module, it is uploaded to x.nest.land which then uploads the files to arweave. But after the files are uploaded, it takes some time to "confirm" the transaction. depending on the (arweave) network traffic, it can take a few minutes to become "readable". The api, website and cdn are not aware of this waiting period so they just assume that the files are done uploading.

In the rewrite (no ETA yet) the module won't get listed in the api.

TillaTheHun0 commented 3 years ago

Thanks for the explanation! This makes sense. In the meantime, consumers may need to add a bit to their publish CIs, after pushing the code to nest, that polls the new x.nest.land url, until a 302 is received.

Thanks again.