cubehouse / themeparks

Unofficial API for accessing ride wait times and schedules for Disneyland, Disney World, Universal Studios, and many more parks
MIT License
538 stars 126 forks source link

Tokyo Disneyland access from AWS Lambda #272

Closed jtmaddux closed 4 years ago

jtmaddux commented 4 years ago

Park Tokyo Disneyland

Context

Describe the bug API works fine running node.js script from my local machine to access data from all Disney parks.

Also running as an AWS Lambda function (ie in Amazon AWS cloud) it works fine on all Disney parks except Tokyo parks.

For Tokyo parks I get an Access Denied message. I tried running the AWS function in both US and Tokyo Amazon cloud instances, but result was the same.

I suspect this is an issue with Disney servers blocking AWS cloud access to their APIs, but curious if anyone else knows or got this working.

Output

2020-01-25T23:29:53.493Z c07584e1-db5a-4ef9-a51f-0c45fb2f9885 ERROR 403: "\nAccess Denied\n\n

Access Denied

\n \nYou don't have permission to access \"http://api-portal.tokyodisneyresort.jp/rest/v1/devices\" on this server.

\nReference #18.4cda387d.1579994993.4fc66cb\n\n\n"

cubehouse commented 4 years ago

I would recommend not using Lambda/Serverless infrastructure to run this library. We cache a lot of data to avoid excessive calls to theme park servers, which will likely not be kept if you run on stateless setups that don't/can't cache data easily.

ImAnAutie commented 4 years ago

I myself am building a mostly serverless app using Firebase, for this one library I plan on having a tiny Digital Ocean server running 24/7 pushing data into Firebase as it works out not only cheaper but more efficient, possibly something worth looking into with your AWS stack.

On Sun, 26 Jan 2020 at 11:08, Jamie Holding notifications@github.com wrote:

I would recommend not using Lambda/Serverless infrastructure to run this library. We cache a lot of data to avoid excessive calls to theme park servers, which will likely not be kept if you run on stateless setups that don't/can't cache data easily.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cubehouse/themeparks/issues/272?email_source=notifications&email_token=AAN7QWZNKR6TCRNK354FGVDQ7VVMLA5CNFSM4KLTVLU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ5RICY#issuecomment-578491403, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN7QW5P7CRC5ZDFHSMJDLTQ7VVMLANCNFSM4KLTVLUQ .

cubehouse commented 4 years ago

That is a very good strategy for leveraging serverless as your API endpoint, but collecting the data in an efficient way.

jtmaddux commented 4 years ago

I tried running themeparks from an EC2 instance and I don't get "Access Denied" from the Tokyo parks when I do that. Thanks

FYI, in practice I've seen that Lambda keeps the process running on the server for 2 hours and then resets it, so all the caching works for two hours and then needs to reload.