-
-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
403 Forbidden #385
Comments
Hi, this error message is very surprising. Is it just happening once or still happening? And just to be sure:
Did you create 2 different lambdas (one for HTTP and one for console)? |
Hi, It's the same lambda, just added API Gateway trigger to it. I've also noticed that the function does execute as Hello World gets echo'd in the logs, but with this error preceding it. Do you perhaps think this is a permission error - 403 Forbidden, perhaps IAM policy needed for API Gateway ? |
OK this is not how things are supposed to run. You need to have 2 different lambdas: one for HTTP, one for the console. Have a look here to create a HTTP lambda: https://bref.sh/docs/runtimes/http.html Make sure to have a separate lambda in Let me know if you still have questions. |
Hi, I'm having the same issue, having followed the documentation on hosting a website. Here's my configuration: service: app
provider:
stage: staging
name: aws
region: eu-central-1
runtime: provided
environment:
WP_ENV: ''
WP_HOME: ''
DB_HOST: ${ssm:/app/database/host}
DB_NAME: ''
DB_USER: ${ssm:/app/database/username}
DB_PASSWORD: ${ssm:/app/database/password}
S3_UPLOADS_KEY: ${ssm:/app/s3/key}
S3_UPLOADS_SECRET: ${ssm:/app/s3/secret}
S3_UPLOADS_BUCKET: '<bucket>'
plugins:
- ./vendor/bref/bref
functions:
wordpress:
handler: index.php
description: ''
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
layers:
- ${bref:layer.php-73-fpm}
events:
- http: 'ANY /'
- http: 'ANY /{proxy+}'
vpc:
securityGroupIds:
- <security-group>
subnetIds:
- <subnet>
- <subnet>
- <subnet>
resources:
Resources:
# The S3 bucket that stores the assets
Assets:
Type: AWS::S3::Bucket
Properties:
BucketName: <bucket>
# The policy that makes the bucket publicly readable
AssetsBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref Assets # References the bucket we defined above
PolicyDocument:
Statement:
- Effect: Allow
Principal: '*' # everyone
Action: 's3:GetObject' # to read
Resource: 'arn:aws:s3:::<bucket>/*' # things in the bucket I'm trying to host a wordpress website. When i set the listening URL (SITE_URL) on Wordpress end it will give the 403 error. |
@leroy this is not the same issue. |
Are you sure? This is my stacktrace:
I've tried googling Lambda runtime api 403 but to no avail. I'm sorry to be reopening this issue, i'm just not sure where to look. |
I figured it out! Turns out i implemented it as a https://bref.sh/docs/runtimes/function.html. I had to configure a proper handler file as documented in the https://bref.sh/docs/runtimes/http.html |
Hi there 👋 I'm running a Laravel app and getting the same issue myself on one particular endpoint. All of my other endpoints work, it's just this one that's failing. At first I thought it might have been a memory overload, but my site is currently deployed on a dedicated server with 1/2 the memory of my lambda functions (500 MB vs 1024 MB). I also thought it might have been a timeout issue, but the endpoint errors out after about 8 seconds, which isn't even close to the 28 second limit on my function (see my serverless config below). This is the error response in my browser:
Super helpful right? It seems like my endpoint code is all running successfully. I sent Log messages to Papertrail all the way up to the return statement in my Controller, and all the logs go in successfully. Plus, no exceptions seem to be thrown in Laravel. Watching the invocation and response in my dev tools, I see the following response header:
and
...thus the connection to this original Issue. Here's the
One last final tidbit that makes this all particularly weird. When I return a hard-coded response in my endpoint like Help would be much appreciated :) |
Hi, these messages are all generic errors. Even if it sounds like it, there is very likely no connection to the old issue. I'll be locking this thread to avoid confusion (and avoid pinging previous contributors), feel free to open a GitHub discussion for community support. |
Hi,
I've deployed successfully.
Testing in Lambda Console works as well, but invoke from API Gateway causes this error:
Fatal error: Uncaught Exception: Error while calling the Lambda runtime API: The requested URL returned error: 403 Forbidden in /var/task/vendor/bref/bref/src/Runtime/LambdaRuntime.php:268
The text was updated successfully, but these errors were encountered: