Coder Social home page Coder Social logo

Comments (28)

baopham avatar baopham commented on May 20, 2024 1

Change to us-east-1 for the region

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

Hello, thanks for reminding me to update the docs. Here are the steps:

  1. Configure your dynamodb credentials in config/services.php
  2. Create your model class as usual
  3. Extend this class with BaoPham\DynamoDb\DynamoDbModel
  4. Set your $fillable property
  5. Use the Eloquent syntax as usual

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

hi, thanks for your reply
but I still have difficult to connect dynamodb

Do i correct below for the model class?
app/Product.php

app/Http/Controllers/ProductController.php

with('products', $products); } }

such as I have a "products" table

  • id
  • name

but here have some errors

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

what are the errors?

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

FatalErrorException in Product.php line 8:
Class 'App\BaoPham\DynamoDb\DynamoDbModel' not found

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

You have the namespace wrong, put \ in front of BaoPham

class Product extends \BaoPham\DynamoDb\DynamoDbModel

If you use an IDE (PhpStorm), it'd help with error like this.

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

Thank you, it have good changing, but have the below error

DynamoDbException in WrappedHttpHandler.php line 192:
Error executing "Scan" on "https://dynamodb.us_east_1.amazonaws.com"; AWS HTTP error: cURL error 6: Could not resolve host: dynamodb.us_east_1.amazonaws.com (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

Please check your services.php again and see if you have put all the correct info. Good way to check also is to use artisan tink and call config('services.dynamodb')

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

services.php

    'dynamodb' => [
        'key' => env('DYNAMODB_KEY'),
        'secret' => env('DYNAMODB_SECRET'),
        'region' => env('DYNAMODB_REGION'),
        'local_endpoint' => env('DYNAMODB_LOCAL_ENDPOINT'), // see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html
        'local' => env('DYNAMODB_LOCAL'), // true or false? should use dynamodb_local or not?
    ],

and i added the code in .env

DYNAMODB_KEY=XXX...
DYNAMODB_SECRET=XXX...
DYNAMODB_REGION=US_EAST_1

and the checking result
is
=> [
"key" => "XXX...",
"secret" => "XXX...",

 "region" => "US_EAST_1",
 "local_endpoint" => null,
 "local" => null,

]

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

error is the same
... "https://dynamodb.us-east-1.amazonaws.com" ...
only us_east_1 to us-east-1 changed

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

are you certain that it is the correct region?

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

yes, i am using "US East (N. Virginia)" which displayed in the top-right corner on aws console
and it works with the no framework php:
'region' => Aws\Common\Enum\Region::US_EAST_1,

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

Or is that is a feasible way to give me a template repository which just let me to fill in the KEY and SECRET and table name? Then i can connect with dynamodb and display the items on my table.

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

It seems more like a network issue actually.

Why don't you put up a quick repo of what you have so far and I can take a look.

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

It is a good idea!
https://drive.google.com/open?id=0B7a_eGs6V1ToaHFyX0VYMVRHU00
The project I use "products" as my testing
Thanks!

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

I will take a look in the weekend.

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

Thank you!

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

I created a table products under region us-east-1 and it's working fine for me. Check your network if somehow it is blocked.

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

hi
I just added my key and secret in .env
then have a table called "products" like this

https://drive.google.com/file/d/0B7a_eGs6V1TobVdtMFZjNnl0XzQ/view?usp=sharing

with itemid and itemAddress attribute

However, when I go to http://localhost:8000/product
I still got the error of

"Error executing "Scan" on "https://dynamodb.us-east-1.amazonaws.com"; AWS HTTP error: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

That sounds more like a different problem. Google will help. For example, http://stackoverflow.com/questions/28858351/php-ssl-certificate-error-unable-to-get-local-issuer-certificate

By the way,
Is itemid your primary key? if so, please set it in your Product class:

protected $primaryKey = 'itemid';

by default your primary key is id

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

am i right?
https://drive.google.com/open?id=0B7a_eGs6V1ToUjhUZEdkZEdnTzg

and this in Product.php

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

Yes, but you should use string for primary key. Dynamodb does not support incrementing ID. You have to set the ID yourself. But this is a separate thing I wanted to point out. You should google for the error that you're getting

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

thanks!
why you are working fine but I cant for the same repo with same changes?

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

My local server has ssl cert setup correctly?

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

I finally got the item data but in an error page
but it is a great step for me
Thank you so much!

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

great

from laravel-dynamodb.

qyqyqy03 avatar qyqyqy03 commented on May 20, 2024

hi
I have a problem with upload photo with S3

In the ..blade.php
{!!Form::file('image')!!}

In the Controller

public function store(Request $request)
    {
..........
$imageFileName = "123.png";
$s3 = \Storage::disk('s3');
        $filePath = '/mybucket/' . $imageFileName;
        $s3->put($filePath, file_get_contents($request->file('image')), 'public');
............
}

Why I have an error on

file_get_contents(): Filename cannot be empty

from laravel-dynamodb.

baopham avatar baopham commented on May 20, 2024

This has nothing to do with this library. Please use Stackoverflow for this.

from laravel-dynamodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.