I'm using Lumen 5.8.4, Dingo package for making api and I'm trying to use third party package pearl (https://packagist.org/packages/pearl/lumen-request-validate) for form request validation because Lumen doesn't support it.
I've set up everything and validation logic: rules and messages works fine when I define them in class(through postmen I receive "this field is required" etc ), but when everything is fine, when all fields are OK (from frontend side) I got this message
{
"message": "Method App\\Http\\Requests\\StoreVehicleRequest::validate does not exist.",
"status_code": 500,
"debug": {
"line": 102,
"file": "E:\\Damjan\\Programiranje\\PHP\\Laravel\\Lumen\\automoto-lumen\\vendor\\illuminate\\support\\Traits\\Macroable.php",
"class": "BadMethodCallException",
"trace": [
"#0 E:\\Damjan\\Programiranje\\PHP\\Laravel\\Lumen\\automoto-lumen\\vendor\\dingo\\api\\src\\Provider\\LumenServiceProvider.php(58): Illuminate\\Http\\Request->__call('validate', Array)"...
What I see here that trace leads to dingos LumenServiceProvider where i have
$this->app->afterResolving(ValidatesWhenResolved::class, function ($resolved) {
$resolved->validate();
});
and I think this one should use pearls RequestServiceProvider, where I have.
$this->app->afterResolving(RequestAbstract::class, function ($resolved) {
$resolved->validateResolved();
});
Or I'm missing something here. Struggling with this whole day. Any ideas?
OK, I've figured out what is going on. RequestServiceProvider is called but after it also Dingo is running LumenServiceProvider witch has an issue with Validator what is shown here
https://github.com/dingo/api/pull/1654/files
So I'm not sure I did the right thing, but this is my solution:
because there is no publishing in Lumen, and I couldn't make it to work with third party packages I've copied LumenServiceProvider in my Provider folder, make a changes, and I've registered it in bootstrap/app.php.
It works for now, hopefully won't make any other problems.
Related
I'm encountering a weird error when one of my Lambda functions is invoked. I have never seen this error. Google searches haven't helped at all. Here's what it looks like :
Ingestion server error
{
"request": {
"url": "https://core.serverless.com/ingestion/kinesis/v1/request-response",
"headers": {
"accept-encoding": "gzip",
"content-type": "application/json",
"serverless_token": "[redacted]"
}
},
"response": {
"status": 500,
"text": "{\"message\":\"Something went wrong forwarding RequestResponseEvent data.\"}"
}
}
I'm pretty sure this has nothing to do with my code since my function works. Occasionally though, for periods of up to about an hour, my function fails with this error. Looking at the error it seems that the Serverless Framework is trying to redirect some data to their servers, for some reason, and failing in the process.
Why is this happening? What is Serverless trying to achieve? What can I do to stop this error from happening? I'm desperate for any insight.
I've also stumbled upon some environment variables that Serverless seems to be setting automatically :
Key
Value
AWS_LAMBDA_EXEC_WRAPPER
/opt/otel-extension/internal/exec-wrapper.sh
OTEL_RESOURCE_ATTRIBUTES
sls_service_name=ODAC-API,sls_stage=dev,sls_org_id=[redacted]
SLS_OTEL_REPORT_LOGS_URL
https://core.serverless.com/ingestion/kinesis/v1/logs
SLS_OTEL_REPORT_METRICS_URL
https://core.serverless.com/ingestion/kinesis/v1/metrics
SLS_OTEL_REPORT_REQUEST_HEADERS
serverless_token=[redacted]
SLS_OTEL_REPORT_REQUEST_RESPONSE_URL
https://core.serverless.com/ingestion/kinesis/v1/request-response
SLS_OTEL_REPORT_TRACES_URL
https://core.serverless.com/ingestion/kinesis/v1/traces
SLS_OTEL_USER_SETTINGS
{}
I have no idea what these are for but it seems related (same url).
Could it have something to do with the sls --console command that I ran? Has it setup some mechanisms to monitor my functions? If so, how can I undo this?
This is really bugging me. Google seems to know nothing of this error, whatever I try to search. Has anyone encountered this before?
This appears to be a backend error coming from the Serverless.com's API.
My guess is you can set console: false in your serverless.yml file and then re-deploy your service to remove the instrumentation - but I haven't confirmed that, it seems absent from their documentation
Hi I'm trying to integrate paystack in laravel 8 but I'm click paynow button it give following error
Client error: POST https://api.paystack.co/transaction/initialize resulted in a 404 Not Found response:
{
"status": false,
"message": "Invalid Split code."
}
anyone can help how can i solve this
thanks
Can you share the request body? It looks like you're trying to pass a split code when you're initializing the transaction, but the code you're passing either:
Doesn't exist on that integration
Exists on the integration but maybe in test mode, and you're using your live keys (or in live mode and you're using your test keys)
Situation:
I've created a website that allows users to create their own simple sub-sites. Initially these are on sub-domains (i.e. newsite.websitecreator.com).These have SSL applied to them via a wildcard certificate *.websitecreator.com. All works fine!
I've also created a means of users being able to purchase a custom domain via an API or route their own domain to point to their subdomain. To achieve this a CNAME is created and pointed to the subdomain. This is routing and fine using an include line in the nginx config which includes all the custom domains:
include /home/forge/websitecreator.com/public/content/websitecreator-customer-domains.conf;
Issue
The main issue is the application of SSL to the custom domains. Obviously the SSL needs to be installed on the server, which has been tried through Forge's LetsEncrypt SSL option within the dashboard, with a view to using the Forge API for future LetsEncrypt when this is automated. However, this is giving me the following error:
Cloning into 'letsencrypt15721234230'...
ERROR: Challenge is invalid! (returned: invalid) (result: {
"type": "http-01",
"status": "invalid",
"error": {
"type": "urn:ietf:params:acme:error:unauthorized",
"detail": "Invalid response from http://newcustomdomain.co.uk/.well-known/acme-challenge/Da6CtvOTJnQVHQyENujDSih81TKuejKuaAWCWXsJKus [88.123.456.9]: \"\u003c!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.01 Frameset//EN\\\" \\\"http://www.w3.org/TR/html4/frameset.dtd\\\"\u003e\u003chtml\u003e\u003chead\u003e\u003cmeta http-eq\"",
"status": 403
},
"url": "https://acme-v02.api.letsencrypt.org/acme/chall-v3/995722342/n7xg9g",
"token": "Da6CtvOTJnQVhh2h3hn2jbSih81TKuejKuaAWCWXsJKus",
"validationRecord": [
{
"url": "http://newcustomdomain.co.uk/.well-known/acme-challenge/Da6CtvOTJnQVHQyENujDSih81TKuejKuaAWCWXsJKus",
"hostname": "newcustomdomain.co.uk",
"port": "80",
"addressesResolved": [
"88.123.123.9"
],
"addressUsed": "66.343.234.9"
}
]
})
Status code 403 tells me that this is unauthorised for some reason.
Question
Despite the approaches tried above, my question is to the SO community is, given the current setup (Forge, Laravel, nginx etc) how would you approach this and any sample code / examples would be greatly appreciated.
I was in the proccess of extending the tutorial mentioned in Step 9, with a NodeJS micro service. However I am having some strange issue with the comunication to the backend.
The flow I have is an App Router that directs to an HTML5 micro service (static buildpack) and this consumes either a Java or NodeJS microservice. The Java part works fine along with authentication scopes, but for NodeJS I am always getting 404 (not found) error when I call the respective path /node/hello (hello should return a function output from server).
This is the xs-app.json I am using for routing
{
"welcomeFile": "index.html",
"authenticationMethod": "route",
"websockets": {
"enabled": true
},
"routes": [
{
"source": "/odata/v4/(.*)",
"target": "/odata/v4/$1",
"destination": "business-partner-api"
},
{
"source": "/",
"target": "/",
"destination": "business-partner-frontend"
},
{
"source": "/node/(.*)",
"target": "/$1",
"destination": "business-partner-node"
}
]
}
The issue is on the /node block the others work fine. I have also noticed another strange issue, is that if I replace the default destination (/) from business-partner-frontend to business-partner-node the app router sucessfully calls the node js server with the authentication being propagated so it appears the issue is somehow related with the xs-app file and not in the destination itself.
I have also unsuccessfully tried to add the port to the destination and adding a staticfile mapping the html5 project but without success.
Anything I might be missing on the node part config?
Best Regards,
The issue is probably in the order of your routes, which is important for the routing. The first match of the current path against source will determine the route. In your case, the / of the second route matches all paths, including /node/....
Reorder your routes so that the node destination comes before the frontend destination.
My laravel 5.5 project works fantastic on wamp local server and doesn't have problem with BLADE templating.
but when I serve it on live server the BLADE template doesn't work properly and debug mode shows :
{
"message": "Undefined variable: user (View: /home/cafegamesepanta/laravel/resources/views/child.blade.php)",
"exception": "ErrorException",
"file": "/home/cafegamesepanta/laravel/storage/framework/views/4e1f0e4c5be0294bbdada500a5c395626107f4d8.php",
"line": 2,
"trace": [
//
notice that I just changed permissions of /strorage folder!
anyone can help? thanks
Clear all files in laravel/storage/framework/views.
Check that your controller has passed the User variable to views.
Check your database connection.