Just wondering if I could get some help. I built a small webpart that sends an email. On my local workbench it works fine however when I deploy to production

Error: Error making HttpClient request in queryable [404] Not Found ::>

My Import

import { sp,  EmailProperties } from "@pnp/sp";

My OnInit establishes context

 public onInit(): Promise<void> {
    return super.onInit().then(_ => {
      // establish SPFx context
        spfxContext: this.context


Send email

  const emailProps: EmailProperties = {
          To: ["test@myorganisation.com"],
          Subject: "This email is about...",
          Body: "Here is the body. <b>It supports html</b>"

        sp.utility.sendEmail(emailProps).then(_ => {
          console.log("Email Sent!");

Sorry, stupidity on my part.

Correct code is:

    spfxContext: this.props.context

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.