Skip to content
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

I'm unable to publish #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

I'm unable to publish #4

wants to merge 1 commit into from

Conversation

mabels
Copy link

@mabels mabels commented Nov 28, 2024

I run vsr per 'npm run dev'.
First I got some SQL constraints problems which I solved by introducing a mergeTags function. I hopefully found the tonality of the project-source code.
Second I run into the problem that extractPackageJSON is not able to extract published tarball. The loop:

for await (const obj of extract(stream))  {
   ....
}

only extracts the first file and than:

ext-3.1 package/index.cjs
✘ [ERROR] A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished.

I don't understand why for now --- any help?
It looks like that streaming-tarball has some issues.

@darcyclarke darcyclarke self-assigned this Dec 2, 2024
@darcyclarke darcyclarke added enhancement New feature or request question Further information is requested labels Dec 2, 2024
@darcyclarke
Copy link
Member

@mabels could you open an issue with an example to reproduce your issues with publishing? ie. is there something specific about the tags you had/setup that would help use debug the other issues? (ie. I know you said there may be issues with how we're streaming the tarball to get & validate the manifest) The way the tags are merged here doesn't do any validation & I'd like to ensure we map to valid keys/throw if they aren't valid based on npm's historical criteria (ex. https://github.com/npm/cli/blob/latest/lib/commands/dist-tag.js#L101-L103)

Comment on lines +8 to +14
console.log(`ext-1`, buffer);
const blob = new Blob([Buffer.from(buffer)])
console.log(`ext-2`);
const stream = blob.stream().pipeThrough(new DecompressionStream('gzip'))
console.log(`ext-3`);
for await (const obj of extract(stream)) {
console.log(`ext-3.1`, obj.header.name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove logs meant for debugging

@@ -135,8 +149,7 @@ export async function publishPackage (c) {
const new_versions = Object.keys(body.versions).filter(v => !versions.includes(v))

if (!results || results.length === 0) {
const insertQuery = `INSERT INTO packages (name, tags) VALUES ("${pkg}", json('{"latest": "${new_versions[0]}"}'))`
await c.env.DB.prepare(insertQuery).run()
await mergeTags(c.env.DB, pkg, { latest: new_versions[0] })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this, somewhat, expands our tagging support, we should validate the tag values before inserting/updating.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how could this been done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants