composer facebook/graph-sdk requires php-http/client-implementation - facebook-graph-api

I am on localhost (xamp) and trying with composer to include facebook graph-sdk according to Facebook SDK for PHP. After using composer require facebook/graph-sdk I got following error:
Problem 1
- Installation request for facebook/graph-sdk ^6.0#dev -> satisfiable by facebook/graph-sdk[6.x-dev].
- facebook/graph-sdk 6.x-dev requires php-http/client-implementation ^1.0 -> no matching package found.
Ok so I used google and found out that something like 'virtual package' is needed to implement. Supposedly it is commonnly php-http/guzzle6-adapter or php-http/curl-client. Since Facebook SDK for PHP says: "There are issues when using the Facebook SDK together with Guzzle 6.x." I chose Curle client.
composer require php-http/httplug-bundle php-http/curl-client
It caused that my another attempt to install Facebook SDK ended with more errors.
Problem 1
- Installation request for facebook/graph-sdk ^6.0#dev -> satisfiable by facebook/graph-sdk[6.x-dev].
- Conclusion: remove php-http/httplug 2.0.x-dev
- Conclusion: don't install php-http/httplug 2.0.x-dev
So I removed it. composer remove php-http/httplug 2.0.x-dev but there is no difference from previous attempt.
I am so confused. How can I install facebook graph sdk??
EDIT:
composer.json file:
{
"name": "tomas/tmvdev",
"description": "wordpress theme",
"keywords": ["WordPress", "Theme"],
"homepage": "https://github.com/vavra7/tmvdev",
"type": "project",
"license": "GNU",
"authors": [
{
"name": "Tomáš Vavřinka",
"email": "email#tomasvavrinka.cz",
"homepage": "http://tomasvavrinka.cz"
}
],
"minimum-stability": "dev",
"require": {
"php-http/curl-client": "^2.0#dev"
},
"autoload": {
"psr-4": {"Inc\\": "./inc"}
}
}

Issue was statement in composer.json file: "minimum-stability": "dev". Composer tried to download version facebook/graph-sdk ^6.0#dev which is not stable version.

Related

Unable to Debug Locally when Using AWS SAM CLI, CDK, and Lambda Layers

I am unable to find example or good documentation on how to debug functions locally when building Lambda functions using the SAM CLI, AWS CDK, and Lambda Layers.
When building an RestApi and simple Lambda function with the CDK and then attempting to debug locally with VSCode using a launch configuration like:
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "hello:app.handler (nodejs12.x)",
"invokeTarget": {
"target": "code",
"projectRoot": "${workspaceFolder}/infrastructure/handlers/hello",
"lambdaHandler": "app.handler"
},
"lambda": {
"runtime": "nodejs12.x",
"payload": {},
"environmentVariables": {}
}
}
the import statements referencing modules from any layer throw an error such as:
{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module '/opt/nodejs/utils'"
Steps to reproduce:
Clone this repo: https://github.com/swizzmagik/sam-lambda-layer-test
Run npm install
Run npm run build
Run npm run api
Observe that the hello function properly resolves the layer references and works
fine when called using curl or postman
Open handlers/hello/app.ts
and try to debug in VSCode by opening the hello.ts file and hitting
F5 Notice that the debugger starts but is unable to import the
module and fails on this line import { buildResponseHeaders,
handleError } from "/opt/nodejs/utils";

How to install a module for drupal 9.1 via composer on EC2 instance of AWS

/home/ec2-user/ - I have the composer.json and composer.lock files under this path. The drupal 9.1 is also installed under this path. I have made composer global by putting the composer.phar file under /usr/local/bin
/home/ec2-user/drupal - While installing the modules via composer under this path, they are getting installed in the below folder,
/home/ec2-user/drupal/modules/contrib. But I can't view the modules in the drupal UI, under extend/modules section. This is specially required for 'phpmailer_smtp' module which requires the phpMailer library to be installed via the composer.
/home/ec2-user/drupal/vendor/phpmailer/phpmailer - this is the path where the library is getting installed. Still on drupal, I'm unable to view the modules installed via composer on EC2. Can someone please help?
"require": {
"composer/installers": "^1.9",
"drupal/core-composer-scaffold": "^9.1",
"drupal/core-project-message": "^9.1",
"drupal/core-recommended": "^9.1",
"drupal/core-vendor-hardening": "^9.1",
"drupal/mailsystem": "^4.3",
"drupal/phpmailer_smtp": "2.0.2",
"drupal/smtp": "^1.0"
},
"installer-paths": {
"core": [
"type:drupal-core"
],
"libraries/{$name}": [
"type:drupal-library"
],
"modules/contrib/{$name}": [
"type:drupal-module"
],
"drush/Commands/contrib/{$name}": [
"type:drupal-drush"
],
"modules/custom/{$name}": [
"type:drupal-custom-module"
],
}

AWS SAM VSCode ptvsd debugging not using breakpoints

I'm trying to follow the instructions I found here for debugging a Python SAM application in VS Code
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-using-debugging-python.html
I'm not sure why they don't use sam build in the expamle, and point to .aws-sam/build but that's what I'm attempting.
My launch.json looks like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "SAM CLI Python debug test",
"type": "python",
"request": "attach",
"port": 5890,
"host": "localhost",
"pathMappings": [
{
"localRoot": "${workspaceFolder}/.aws-sam/build",
"remoteRoot": "/var/task"
}
]
}
]
}
I'm triggering the Lambda's directly for now and so I'm invoking them like this:
sam local invoke -d 5890
I'm then putting a breakpoint at the beginning of the Lambda I find in the build folder, but when I start the debugger in VS Code it executes the Lambda without stopping at the breakpoint.
I created a GitHub repo with the test project I'm using and description of how I'm using it.
https://github.com/rupe120/aws-sam-python-debugging-test
Could someone help point me at what I'm missing in my setup?
So, the recommended way to do this is with the AWS Toolkit extension.
https://github.com/awslabs/aws-sam-cli/issues/1926#issuecomment-616600799
So the docs suggest using a localRoot of "${workspaceFolder}/hello_world/build" (assuming one is using the Hello World template). However, it only works when removing the build at the end of the path:
"localRoot": "${workspaceFolder}/hello_world"
This way, I got it to work without the AWS Toolkit.

Why does my Cloud Function deployment fail with an INVALID_ARGUMENT error?

I am working on a Google Cloud Functions Project and I want to use the AWS-SDK so I edit the package.json and it looks like this:
{"name": "sample-http",
"version": "0.0.1"
"dependencies": {
"aws-sdk": "2.574.0"
}
}
The deployment crashes with the following message in the logs: INVALID_ARGUMENT
I am working in the Browser environment.
Can somebody help or does it have something to do with the fact that I don't use the paid plan until now?
I already saw this post but the answer is not working for me as you can see.
Your JSON is not valid, it is missing a comma after the version item:
{
"name": "sample-http",
"version": "0.0.1",
"dependencies": {
"aws-sdk": "2.574.0"
}
}
Using npm install to create a package.json should allow you to avoid issues like this. Additionally, there's a good number of publicly usable JSON validators on the web to test for issues like this.
by some reason when I install packages for cloud functions, package Json is not updated

How to change build directory in Ionic 3 build process?

I'm developing a PWA using Ionic 3.
Normally the JavaScript files generated by the build to browser process of Ionic 3 are in www/build folder.
I wish to change this folder to www/build/v1 and, of course, keep the application working.
How could I change the build process of Ionic 3 to achieve this result?
The simplest way is add "config" section to your package.json
{
"name": "projectname",
"version": "0.0.1",
"author": "Ionic Framework",
...,
"config": {
"ionic_www_dir": "www/v1",
"ionic_build_dir": "www/v1/build"
},
"dependencies": {
...
}
You can read "Custom Project Structure" here ionic docs.
You may want to try the config option in the package.json file to provide custom build configuration.
To get started, add a config entry to the package.json file. From there, you can provide your own configuration file.
Here's an example of specifying a custom configuration:
"config": {
...
"ionic_rollup": "./config/rollup.config.js",
"ionic_cleancss": "./config/cleancss.config.js",
...
},
You may want to see this Ionic documentation for more information.