dynamodb-local
dynamodb-local copied to clipboard
Error: Invalid or corrupt jarfile DynamoDBLocal.jar
I have a fairly simple test but when I try to use the package I get a corruption error, any ideas?
Sample code below:
const chai = require('chai');
chai.should();
const AWS = require('../../src/services/aws');
const DynamoDbLocal = require('dynamodb-local');
const dynamoLocalPort = 8000;
// optional config customization - default is your OS' temp directory and an Amazon server from US West
DynamoDbLocal.configureInstaller({
installPath: './dynamodblocal-bin',
});
const VenuesService = require('../../src/services/venues.service');
describe.only('Venues Service test', () => {
before(async () => {
this.venuesService = new VenuesService(AWS);
this.child = await DynamoDbLocal.launch(dynamoLocalPort, null, [], false, true);
console.log(`Started Local DynamoDB - PID [${this.child.pid}]`);
});
after(async () => {
await DynamoDbLocal.stopChild(this.child);
});
describe('a test', () => {
it('should pass', async () => {
const exampleVenue = require('../data/dummy_venue');
await this.venuesService.createVenue(exampleVenue);
done();
});
});
});
I see it downloading the jar to ./dynamodblocal-bin
Any ideas on this, what am I missing?
thanks in advance
Delete the folder .dynamodb on your project root folder then run sls dynamodb install again to download dependencies. Ensure it gets to 100%.
Had the same problem on mac os. Reinstalling Java fixed for me.
I have the same problem on Mac OS as well. I tried the current jdk and jdk version 8. Reinstalling didn't help. Any suggestions?
Works with sudo yarn test. Sorry!
Do you know where the .DynamoDBLocal.jar file gets downloaded to?
I found the dynamodblocal installed in $TMPDIR
I found the dynamodblocal installed in $TMPDIR
Okay, I can't find it in there unfortunately. With sudo I can't watch the tests, so I'd like to change the access rights of the .DynamoDBLocal file but can't find it.
Okay it works now without sudo. No idea why, thanks anyway! :-)
I'm also encountered with this issue and this is the procedure I've done to solve it:
- download the jar manually (the url is from the package) https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz
- unzipped the tar file to the PATH: os.tmpdir() (you can simple execute this function in a simple script or via node cli)
- Changed the folder name to dynamodb-local
- sudo chmod 777 ./DynamoDBLocal.jar (the Jar is inside the folder)
This fixed my issue on my local machine.
@Davidislit
Thanks that works. Originally i used sls dynamodb install but realised that /DynamoDBLocal_lib was completely empty and so was /third_party_licenses. I then downloaded the jar manually from your link. Copied the extracted contents into my project's /.dynomodb , sudo chmod the .jar and its running now.
Using this on a private library without serverless ... I am on macOS Big Sur ... none of the workarounds work. Throws the same error.
I guess it's an issue of the cloud region/zone, most probably.
%temp%\dynamodb-local on windows.
I solved the problem by deleting the directory /tmp/dynamodb-local on Linux
For other operating systems, it's the one defined at https://github.com/rynop/dynamodb-local/blob/master/index.js#L17
I am facing the same issue on Mac. Where should I put the jar file?