How do I access dynamodb(or lambda) from a real-time server?

is it possible?

I have included aws-sdk in realtime server (nodejs). But the server build failed.

If anyone knows how to do this, please respond.

thx

Hi-

I’m going to loop in the engineer that validated the possibility of doing this on our side and see if they have any suggestions.

This sounds like pretty much what they did. I’d suggest creating a super simple RTS fleet w/ no dependencies such that it goes active. Then update the script to what you have including the sdk. If that fails I think you should have some info available in the server logs.

If you still get stuck, let us know the fleet id along with where you got the version of the sdk you’re using (npm, download, etc). We could then take a peek and see if we have further suggestions.

I am facing the exactly same issue.

Please leave some tips if anyone knows any resolutions.

Other node modules, such as “loadash” and “hashish”, can be loaded like below

var _ = require('loadash');
var Hash = require('hashish');

However, when aws-sdk is included in node_modules directory, the fleet seems to fail to be activated. Error occurs from Activating state.

Please let me know if you have resolved issues regarding loading aws-sdk.

Much appreciated in advance.

@Pip @Ben @Matchmaker

I am tagging you because you seem like you have answered a lot fo questions and might have an idea about this issue.

Please let me know if there is a resolution for it.

Thanks.

hi brian, thank you for respond.
i tried a simple rts but got fail.
im using npm(sdk) version 2.493.0.

fleet id : fleet-4aa2c376-9efb-4b08-a4bc-d3005b4a6a77

Hi @BrianS-aws,

Thanks for your kind suggestion.

I have tried as you suggested with several other cases, however, the fleets do not seem to be updated after editing the scripts to new versions. Furthermore, no error logs come up and the fleet is created based on the previous version. I would like to know what is actually going on.

I am using npm and the version 2.488.0 and the fleet ids are fleet-8940a60d-c5c0-4459-98c4-6c79a4d01a6b and fleet-aedfeca8-4695-469c-8b6c-708fb18e6d33.

please let me know if you get to know anything…

Thanks,

Bobby

Your help would be much appreciated.

I am literally stuck and not making any progress from that point.

Please check it out for me @BrianS-aws

Thanks very much in advance.

Hi, @BrianS-aws

I want to know how things work.

It’s been a while since I posted my answer, but I have not responded yet, so I reply again.

@Al…Murray @Alexis

I am tagging you expecting you can give me a solution for it since @BrianS-aws seems like he’s not around.

Please have a look at this error and let me know what I can do about it.

Thanks very much in advance.

Hi-

Thanks for the information. We are investigating and will reply once we have more information.

2 Likes

Hi @BrianS-aws,

I could not afford to keep those fleets due to their pricing.
I have deleted them. If you find out anything or have other suggestions, please let me know.

Thanks,
Bobby

Hi,

@bobbylee and @DevIp,

I took a look at your fleets and I can confirm that there is a bug with the RTS feature where scripts with aws-sdk fail to go active(or fails at updateScript). We have created a backlog item to address this bug, I will update this post once the fix for the issue is out.

2 Likes

Hi-

The fix for this bug has now been deployed to all regions. Feel free to try again.

Hi, @BrianS-aws
Fixed bugs were builded. but in the dynamodb(or lambda) script part, the build failed again.

Added part :

var aa = new AWS.DynamoDB.DocumentClient();

or

var aa = new AWS.Lambda();

Please Show me the example test code used to solve the problem.

Do you have an example of what your logs show here? How is this code failing? Things could fail due to bad code or bad configuration. Are you failing including the SDK ie

var AWS = require("aws-sdk");

AWS.config.update({
    region: "us-west-2",
    ...
});

You can debug some of this yourself while waiting for the GameLift team to respond:

  1. Deploy a minimal server that works
  2. Remote access your instance in a fleet: https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-remote-access.html
  3. Tail your logs and ensure everything is working
  4. Update your script package

1-3 are optional, just so you can be in a clean state. You can also scale your fleet to 0 and then back to 1.

The important thing to get right is the structure of your zip. It should look something like:

myscript.js
node_modules/aws-sdk/…

Can you confirm whether or not that’s currently the case for you?