question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when using `os.get()` to download file from object store

See original GitHub issue

I hate to keep blowing you guys up. You’ve been great. Hopefully this is the last issue cough cough.

I’m attempting to download a file in the object store using NodeJS 16.16.x. It fails (unless I upload an encoded string and try to download it was encoded sc.encode("some string");)

When trying to download an object that was uploaded as an encoded string sc.encode("some string");, downloading the object works fine and I can decode the object, save the chunks to a file and/or log them.


I know the file i’m uploading is uploaded properly because I can get the file using the nats cli and the file opens properly.

const obj = await this.os.get('latest/latest.sql.gz');
if (obj === null) return null;

await this.fromReadableStream(obj!.data);
async fromReadableStream(rs: ReadableStream<Uint8Array>) {
  const reader = rs.getReader();
  // WE ARE GETTING HERE. `reader` looks good
  let i = 1;
  while (true) {
    // WE ARE NOT GETTING HERE. SEE ERROR BELOW FROM NATS-SERVER
    const { done, value } = await reader.read();
    if (done) break;
    console.log(`Chunk ${i++}`);
    if (value && value.length) {
      console.log(`chunk: ${value}`);
    }
  }
}
NatsError: unable to recreate ordered consumer OBJ_my-stream at seq 1
at /myproj/node_modules/nats.ws/nats-base-client/jsclient.ts:724:22
code: 'REQUEST_ERROR',
chainedError: NatsError: stream name in subject does not match request
at checkJsErrorCode (/myproj/node_modules/nats.ws/nats-base-client/jsutil.ts:205:14)
........
    code: '400',
      chainedError: undefined,
      api_error: {
        code: 400,
        err_code: 10056,
        description: 'stream name in subject does not match request'
    }
  }
}

Thanks for any pointers here.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jmordicacommented, Dec 1, 2022

Thanks for the follow up! Good to go.

0reactions
aricartcommented, Dec 1, 2022

@jmordica I believe this was sorted out - there were inconsistencies in some of the changes introduced in Go and the javascript library which were resolved. If you find another issue please feel free to reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object Storage - Error when reading text file - Stack Overflow
When trying to read the content of a text file I received the error message "java.lang.ClassCastException: org.openstack4j.openstack.common.
Read more >
Fix file download errors - Google Chrome Help
This error means you don't have permission to download this file from the server. To fix it, go to the website where the...
Read more >
tempfile — Generate temporary files and directories — Python ...
Return a file-like object that can be used as a temporary storage area. The file is created securely, using the same rules as...
Read more >
bulk-download — OCI CLI Command Reference 3.22.0 ...
Download all objects that match a given prefix. Limiting downloaded objects using a prefix and delimiter. Overwriting or skipping files. Global Parameters.
Read more >
Troubleshoot Azure Files problems in Windows (SMB)
Download and Install Storage Explorer and connect to your file share backed by Azure Files. You can also use PowerShell which also uses...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found