NextJS 13 + sendGrid - sendgrid

I am currently trying the new nextjs13 experiemental appDir, in doing so I trying to get sendGrid working, on previous versions of nextjs I had a sendMail.ts in the api folder and would make fetch requests to it inorder to send out the email.
I trying to get a similar setup working with nextJS 13 with no luck, any idea on how I can get it working?

Related

Azure functions and Web app with Azure SignaR

I'm pretty new to Azure SignalR and SignalR in general, I'm currently using Azure SignalR(default) for my Web App to send simple notifications to React application. Now I need to send same type of messages from Azure function(dotnet isolated) to the same React application but I'm facing some difficulties to get it all working. I've read quite some documentation but I can't find any example of how to send messages properly from az function to existing SignalR in default mode. When I add .AddSignalR().AddAzureSignalR("connection string") in functions startup I get exception that Azure signalR is not connected yet when I try to send a message
Just trying to find a right direction to look at, for now only found solutions to have 2 separate hubs for az function and web app and connect react app to both or send http requests from az function to web app and work with hub in web app but both seem to be quite shaky

Why do I get authentication error when trying to access PayPal Sandbox (ref REST API app)?

As requested by Preston PHX, I uploaded a full copy of my
code to Dropbox:
My test ASP.NET Web App
I hope this helps someone to identify what I may have done wrong
#####################################
I am trying to use the sample code at https://github.com/paypal/Checkout-NET-SDK/tree/develop/Samples to make contact with the Sandbox but it doesn't work for me. In order to find out why, I ran my code in Visual Studio under Localhost in debugging mode, using several breakpoints.
This line of code in my test page ...
var createOrderResponse = CreateOrderSample.CreateOrder(true).Result;
... displayed the following error:
Inner Exception 2:
HttpException: {"error":"invalid_client","error_description":"Client Authentication failed"}
However, it was the environment function in PayPalClient.cs (modified to use my PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET) that appears to have generated the error:
public static PayPalEnvironment environment()
{
return new SandboxEnvironment(
System.Environment.GetEnvironmentVariable("PAYPAL_CLIENT_ID") != null ?
System.Environment.GetEnvironmentVariable("PAYPAL_CLIENT_ID"):"<<PAYPAL-CLIENT-ID>>",
System.Environment.GetEnvironmentVariable("PAYPAL_CLIENT_SECRET") != null ?
System.Environment.GetEnvironmentVariable("PAYPAL_CLIENT_SECRET"):"<<PAYPAL-CLIENT-SECRET>>");
}
I very carefully copied my PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET from the REST API app I created via the PayPal Developer Dashboard. Apart from that, the GitHub sample code has not been modified. I could see no requirement in the GitHub code to specify a Sandbox URL and assume that this is provided by the PayPalCheckoutSdk via the use of "return new SandboxEnvironment()".
It's not obvious to me why my attempt to connect to this Sandbox account is failing the authentication process. What might I be doing wrong? Is it anything to do with my use of Localhost?
EDIT on 1 Nov 2021 in response to Preston PHX
Creating a new Sandbox Client ID and Secret made no difference. Prompted by another forum post I read some time ago, I also tried using ngrok (for the first time) to open http port 80 to facilitate PayPal testing via Localhost, but the connection to the Sandbox still failed authentication.
Sandbox Client ID: AZcb8XrqhJEUO7lS_JtKSe3sdNDLESmo3ekhupDKTL1J9vQCKVOzacCjO3PBQwSfngYkLGa-qS7EUrGV
Secret:
EBEcuPewHdzCB8p0qE1Yszjk2eMyFCstzkL0Diz2WC5IQREsu6cDHr7yFG9a-GDIyljb-KRb2DA6Hoey
I installed curl (plus Bash and Git) on my Windows 10 PC and ran the curl command specified on the get-an-access-token page. I couldn't find a way to post the result here in an easily readable form so I put it in a Word doc and uploaded that to Dropbox.
https://www.dropbox.com/s/knia3y2ighfzxpa/Result%20of%20PayPal%20curl%20command.docx?dl=0
Edit on 2 Nov 2021
As requested by Preston PHX, I have uploaded a copy of the ASP.NET Web App I have been using for my tests to Dropbox.
https://www.dropbox.com/sh/4uclfs2lexv4v42/AAAjoZIN5cEMV1mu0cYi24zKa?dl=0
I've only uploaded the project folder, as I'm guessing that it is unnecessary to upload my Solution files.
Create a new sandbox client ID and secret in the developer dashboard. Test with the new client ID and secret.
If issues persist,
Update your question with both the new sandbox client ID, and the new sandbox secret.
Update your question with a sample curl command to get an access token, showing the entire command and the entire response in your question.

How to call and read API REST with odoo 12 ( from my application to odoo)

I created a REST API with my web application (PHP) and I want to manage this data with Odoo.
So, I want to create my own module on Odoo to read this REST API from my web application with odoo
( i want to display the result of my API on odoo not inverse ).
From My Application to odoo Not odoo to my application
Please guide me how to call and read the REST APIs with on Odoo.
Thank you

How to prevent raw github tokens from expiring

I want to fetch a file from a github repository and read it from my application using http request url.
I tried using the below http url.,
Example:
https://raw.github.xxx.com/sample-repo/config-details/master/conf/application-dev.conf?token=ABAD5JUZ7O84U7CIKEU4MGY5UWJU6
It worked well, but after a week the token got expired. So I am getting "404: Not found" when I try to fetch the file.
Is there any way to prevent the token from expiring or any better solution to solve this problem?
Update:
Actually I am trying to implement a remote config server in play framework.
I am using play-rconf-http (a library which helps to fetch a config file hosted in a http server)
I will set the remote file url in my app's config file as below,
remote-configuration.http.url = "https://raw.github.xxx.com/sample-repo/config-details/master/conf/application-dev.conf?token=ABAD5JUZ7O84U7CIKEU4MGY5UWJU6"
So while my server starts it will fetch the file from the remote server and load the configuration.
It was working as I expected, but after few days the tokens are getting expired. So I need to solve it.

Facebook [function.file-get-contents]: failed to open

I am geting function.file-get-contents failed to open when i try to connect with server , my server fails to connect ,same application work in all server but in my server i am getting this error , Any solution , is that server CONFIG Issue ..
YOU CAN CHECK SERVER Config here http://gomandi.com/phpinfo.php
In the last few days I saw a few complaints about file_get_contents not working well when trying to access facebook api using it.
Take a look at these threads:
Getting 404 Error from Facebook Graph API
Facebook Auth with high traffic sites: empty access tokens, empty /me
Facebook API 400 Bad Request
You might find out what's wrong there. I suggest that you try to use something other than file_get_contents, such as curl, which was suggested in those threads as well (along side some code snippets)